I'm trying to include a joystick in my app, coming from here : https://github.com/controlwear/virtual-joystick-android
Gradle settings :
// 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'
}
And the error I get : Error
I understand that it's trying to find this library but it's not searching on github and I don't know how to tell him.
I have already tried to put this line :
maven { url "https://jitpack.io" }
and then :
implementation 'com.github.controlwear:virtualjoystick:1.10.1'
But I get the same error
EDIT :
Okay so I'm very dumb, sorry for the inconvenience, you just have to put this inside settings.gradle :
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
}
}
Thanks a lot for helping me !
CodePudding user response:
Have you added the maven repositories to your allprojects section?
// 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()
}
}
Edit: According to https://mvnrepository.com/artifact/io.github.controlwear/virtualjoystick?repo=jcenter the library is available on jcenter()
CodePudding user response:
Add 'jcenter()' inside your settings.gradle
repositories {
google()
mavenCentral()
jcenter()
}
I hope this might solve your problem. Thank you.