可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am using MPAndroidChart libarary in android studio.But when i am trying to sync gradle which given an error as below image. Gradle text is here to compile MPAndroidChart libarary.
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
Please help to resolve this problem. Thanks in advance
回答1:
Add
maven { url "https://jitpack.io" }
to repositories under allprojects not under buildscript see screenshot:
回答2:
Putting
repositories { maven { url "https://jitpack.io" } }
in build.gradle in app folder fixed my issue!
回答3:
The problem was solved after restarting android studio --> rebuild project.
回答4:
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
回答5:
https://stackoverflow.com/a/29742712 The JitPack repository shouldn't be under buildscripts in this case. It should be just under repositories:
回答6:
I had the same problem after adding this one in the gradle solved my problem:
repositories { jcenter() maven { url "https://jitpack.io" } } `
回答7:
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.
回答8:
Run gradle wrapper task from command line
cd ~/AndroidStudioProject/myproject/myapp ./gradlew tasks
回答9:
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"
回答10:
Or just rebuild your project. Worked for me