I am trying to use MPAndroidChart, but there is occuring build gradle problem.
I reference the github document below.
https://github.com/PhilJay/MPAndroidChart
I follow the 'Gradle Setup'
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
This is how I put the codes
and when I started to build it the error code is
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app\build.gradle'
Did I put the build code in the wrong way? or did I missed some important settings?
Probably, you need to append the entry, maven { ... } to the dependencyResolutionManagement.repositories clause in settings.gradle.
app/build.gradle
// repositories {
// maven { url 'https://jitpack.io' }
// }
settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
I am using https://github.com/afollestad/material-camera.
As i do add compile 'com.afollestad:material-camera:0.4.4'
I giving me error:
make sure to add those lines to your gradle file
repositories {
jcenter()
maven { url "https://dl.bintray.com/drummer-aidan/maven" }
}
I am looking for help on the resolving issue with Android Gradle.
in the /app/build.gradle :
dependencies {
compile 'com.leaking.slideswitch:app:1.0.0'
}
allprojects {
repositories {
mavenLocal()
maven{
url 'http://xlab-tech.com:45682/nexus/content/groups/public/'
}
mavenCentral()
jcenter()
}
}
But messages Gradle Sync:
Error:(34, 13) Failed to resolve: com.leaking.slideswitch:app:1.0.0
com.leaking.slideswitch is not published in maven anymore, to be confirmed you can search there. What I can suggest is just create a new class called SlideSwitch.java and copy all codes from here. Then You can do your task as usual. Hope this may help.
I followed this guide to add an ArcGIS map to my app, but it doesn't work. I get the following error:
Error: Failed to resolve: com.esri.arcgis.android:arcgis-android:10.2.6-2
What am I doing wrong?
From your screenshots, you put your maven block in the wrong place. You put it under buildscript -> repositories, but according to https://developers.arcgis.com/android/guide/install-and-set-up.htm it should be under allprojects -> repositories:
allprojects {
repositories {
jcenter()
// add the esri arcgis maven repo
maven {
url 'http://dl.bintray.com/esri/arcgis'
}
}
}
The way you did it in your screenshot would cause the error you see.
As of 2021, the URL has been changed to https://esri.jfrog.io/artifactory/arcgis according to this announcement. So now you have to do it like this.
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://esri.jfrog.io/artifactory/arcgis'
}
}
}
I'm using MPAndroidChart library in android studio. But when I'm trying to sync gradle I get an error as shown in below image.
Gradle text is here to compile MPAndroidChart library.
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
How can I resolve this problem?
Add
maven { url "https://jitpack.io" }
to repositories under allprojects not under buildscript see screenshot:
Above solutions did not work for me. I used below to get MPAndroidChart lib working on my project.
Downloaded the latest MPAndroidChart jar from: https://jitpack.io/com/github/PhilJay/MPAndroidChart/v3.0.1/MPAndroidChart-v3.0.1.jar
Copied the downloaded MPAndroidChart-v3.0.1.jar file to YourProject/app/lib directory
Compiled the following dependency at app level build.gradle
dependencies {
compile files('libs/MPAndroidChart-v3.0.1.jar')
}
re-sync the gradle
Go to build.gradle Add the maven { url 'https://jitpack.io' } in both buildscript{}
and allprojects{} as below :
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Remember to Sync.
Putting
repositories {
maven { url "https://jitpack.io" }
}
in build.gradle in app folder fixed my issue!
The problem was solved after restarting Android Studio > rebuild project.
I solved this by putting maven { url 'https://jitpack.io' } inside repositories in settings.gradle
In Settings Gradle just add this following code:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
for new android studio version set repository in settings.gradle file
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
// Warning: this repository is going to shut down soon
}
I had the same problem after adding this one in the gradle solved my problem:
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
`
For me the issue was resolved by placing code in below order.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://maven.google.com" }
}
}
You could encounter this issue if your gradle offline mode is enabled.
turn it off in android studio, Settings > Gradle and uncheck "Offline work" and sync.
I had to move maven { url 'https://jitpack.io' } to be the last declaration after google(), and jcenter().
As the Android studio is updated so you have to control your dependency form your setting.app
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io' }
}
}
Kindly place this line the respiratory
maven { url 'https://jitpack.io' } //as i have done above
Or just rebuild your project. Worked for me
Build-> Rebuild the project, then re-sync the gradle file.
One Problem can also be, that you are behind a proxy.
So there are two possibilities:
Add your proxy config to android Studio, ore you can also add a gradle.properties file in your project root.
there you have to enter the following credentials:
systemProp.http.proxyPassword=
systemProp.http.proxyHost=
systemProp.http.proxyUser=
systemProp.http.proxyPort=
systemProp.https.proxyPassword=
systemProp.https.proxyHost=
systemProp.https.proxyUser=
systemProp.https.proxyPort=
So the https Properties are pretty necessary. I figured out that often the repositories are available over both protocols. but sometimes only over http or https.
Run gradle wrapper task from command line
cd ~/AndroidStudioProject/myproject/myapp
./gradlew tasks
This worked for me.
If your under proxy add this lines in gradle properties(project properties)
systemProp.http.proxyHost= "Your proxy"
systemProp.http.proxyPort= "Proxy port"
systemProp.https.proxyHost= "Your proxy"
systemProp.https.proxyPort= "Proxy port"
The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:
As you can see here on medium or here on the github you have to copy the lib of MPChart AND the Jetpack. There is no reason to fail if you do this.
Don't forgot jetpack.io