Я пытаюсь включить джойстик в свое приложение, взятое отсюда: https://github.com/controlwear/виртуальный-джойстик-андроид
Настройки Грейдла:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.tau.betterhovercraft"
minSdk 16
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'io.github.controlwear:virtualjoystick:1.10.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
И ошибка, которую я получаю: Ошибка
Я понимаю, что он пытается найти эту библиотеку, но не ищет на github, и я не знаю, как ему сказать.
Я уже пытался поставить эту строку:
maven { url "https://jitpack.io" }
а потом :
implementation 'com.github.controlwear:virtualjoystick:1.10.1'
Но я получаю ту же ошибку
РЕДАКТИРОВАТЬ :
Итак, я очень тупой, извините за неудобства, вам просто нужно поместить это в настройки.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
}
}
Большое спасибо за помощь мне!
Вы добавили репозитории maven в раздел allprojects?
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
Обновлено: согласно https://mvnrepository.com/artifact/io.github.controlwear/virtualjoystick?repo=jcenter библиотека доступна на jcenter()
Он не закрыт, он просто не принимает новые пакеты. В настоящее время они не планируют закрывать его в ближайшем будущем, но да, не помешает сохранить зависимости в другом месте.
Добавьте 'jcenter ()' внутри вашего settings.gradle
repositories {
google()
mavenCentral()
jcenter()
}
Я надеюсь, что это может решить вашу проблему. Спасибо.
Это работает, я просто тупой.... Большое спасибо!
Я рад, что могу помочь. ?
Если я правильно помню, репозиторий JCenter был закрыт в прошлом году...
Пробовали скачать одну из версий? Я думаю, что все это потерпит неудачу, потому что, если я правильно помню, репозиторий JCenter был закрыт 1 февраля 2022 года testfairy.com/блог/…