So this is a little new to me, I am using adblock project and showing my website from webviewer but i want to not show my website's ads into it, so i used adblock project for the same. But somehow i am getting this weird error of not founding
com.google.android.gms:play-services-ads:15.0.0
Failed to resolve: com.google.android.gms:play-services-ads:15.0.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
After i clicked on Install Repository and sync project the SDK manager says
Could not find dependency "com.google.android.gms:play-services-ads:15.0.0"
Configs:
In build.gradle(project)
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
And in build.gradle(Module:libadblockerplus-android-webviewapp)
dependencies {
compile project(':libadblockplus-android-settings')
compile project(':libadblockplus-android-webview')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services-ads:15.0.0'
}
adding
maven {
url "https://maven.google.com"
}
to the other repositories block in your build.gradle file. Fixed the issue. Thanks #stkent
You should add
maven {
url "https://maven.google.com"
}
to the other repositories block in your build.gradle file.
From your posted snippet, it appears you have already added it to the buildscript block's list of repositories. However, those repositories are only used to search for dependencies for the building of your application. See this SO question for more discussion on the difference between the repositories and buildscript.repositories blocks.
Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
I see this error when I open my projectI cant install constraint-layout:1.0.2, there is some error strong text
Your project's build.gradle should have the content as below.
All the Google specific dependencies are now hosted on their own Maven Repository.
If you still find it confusing, just create a new Project from scratch using Android Studio 3.0.1 and all the dependencies would be properly configured.
buildscript {
repositories {
google() // Speficically this entry
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
First of all, make sure to update your Android Studio. Second thing, make sure you import the Google maven repository into your project gradle file. Then, you should be able to install ConstraintLayout.
Here's the solution:
repositories {
maven {
url 'https://maven.google.com'
}
}
then add this line in dependencies:
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'
I forked a public MediaPicker library and forked it on Github. After making some changes to the library, I made a release of the project. I checked JitPack which is showing all ok for the release but I am still unable to import it. Following is the library url for JitPack
https://jitpack.io/#rohankandwal/MediaPicker/2.3.4
I have checked my root Gradle's setting and made sure that I have following lines added-
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
I tried importing the library by using following code -
compile 'com.github.rohankandwal:MediaPicker:2.3.4'
or
compile 'com.github.rohankandwal:libary:2.3.4'
I have also asked another developer to import library but he is also unable to do so, please advice what am I missing ? The Github link to library is
https://github.com/rohankandwal/MediaPicker
Just replace this from :
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
to:
allprojects {
repositories {
maven {
name "jitpack"
url "https://jitpack.io"
}
}
Happy coding!!
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
[I'm a newbie] I want to include a git library in android studio -> https://github.com/florent37/MaterialViewPager
I tried this. New-> import module -> downloaded file address
But it's giving some errors.
You dont have to import a module .
Just put the path in your build.gradle dependencies and use it as described.
e.g:
dependencies {
compile ('com.github.florent37:materialviewpager:1.0.3.2#aar'){
transitive = true
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
working code: add maven { url "https://jitpack.io" } to your project level gradle.