suddenly gradle is unable to build the same code that was working moments ago !
my project depends on google play service dependencies
it says :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
I think the aar file was removed from google by mistake
Does anyone have any idea, what is going on?
Add google() repository in your build.gradle. And check that google() is before jcenter().
The problem seems to be with jcenter. I have spent hours together with this problem and your problem seems to be similar to mine and I think the following solution should work.
For some reason and for many libraries in jcenter, the pom files of many libraries are kept in place but corresponding aar files have been removed. This is also the case with play-services-basement library. Check the following here for reference ( pom file of play-services-basement is available at jcentre here but aar file is not available at jcentre here):
Solution :
In your project level gradle file , change the following block of code
allprojects {
repositories {
jcenter()
google()
}
}
to
allprojects {
repositories {
google()
jcenter()
}
}
why this works ?
In our first code block, when gradle tries to resolve a dependency in the repository(in my case,it was google-services-basement in jcentre repository), it ddi not get resolved as corresponding aar files has been removed. As a result , build fails with something like :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
In our second code block, google repository has been referenced before jcenter repository. When gradle build starts, it looks first in the libraries listed first in repositories{... for resolving any library that is used in the project. Now, when gradle tries to resolve play-services-basement in jcenter, it is successful in resolving dependency as corresponding aar file has been made available by google repository(the same aar file of latest version is not available in jcenter repository) which has been referenced before jcenter repository is assessed. Do check and let me know if that works.
IN Worked
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
Related
I Got this error after installing Android Studio
A problem occurred configuring root project 'afsar'.
> Could not resolve all files for configuration ':classpath'.
> Could not find bundletool-1.11.0.jar (com.android.tools.build:bundletool:1.11.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.11.0/bundletool-1.11.0.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I added these lines to gradle but not work:
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
jcenter()
Finally I downloaded bundletool-1.11.0.jar file but I don't know where to paste it. please help!
Answer:
I selected the latest version of gradle for my app and my problem was solved!!!
gradle-version: 8.0-rc-2
Android-gradle-plugin-version: 7.4.0-beta04
First, you shouldn't HAVE to download dependencies manually. Usually, when Gradle can't find an existing artifact from a well-known repo, it's just a sign that you have some network issue going on (i.e., proxies, firewall, other network security). If you can point a web-browser to https://www.gradle.org, you should be able to have Gradle do the downloading for you if you sort out the real problem.
Some things that might help are replacing jcenter() (now non-existent--see here: "JCenter is at end of life" android lint warning, what is the replacement? ) with something like mavenCentral(), and perhaps the maven.google.com with its shortcut, google().
Then, check your proxy settings in gradle.properties (perhaps with the answers here: Gradle proxy configuration ).
But, if you do have an artifact in hand, and you just want to use it, you can use the flatDir inside of repositories { ... }, such as described here:
https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
Gradle build using plugins and dependencies from "flatDir"
flatDir uses a path specified as a "repository". Together, it might look like:
repositories {
google(); mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs "${projectDir}/libs"
}
}
This will look in multiple existing repositories, as well as search the folder libs/ in your project for the local copy of the .jar.
I have a unity project I am exporting that project as android studio project while opening the android studio project I am getting this error
Gradle sync failed: Could not find manifest-merger.jar
(com.android.tools.build:manifest-merger:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.0.1/manifest-merger-26.0.1.jar
I have a few old exported project that was working fine before but today they are also giving the same error.
I finally fixed the issue. This may be a workaround but it works.
So if anyone having this issue, just follow this:
Swap the position of jcenter() and google() in project gradle file and in also all the other module you have in your project. Like in mine I have crashlytics, fabric so just remember to make the changes in their build.gradle file as well:
buildscript {
repositories {
jcenter()
google()
}
}
to
buildscript {
repositories {
google()
jcenter()
}
}
Before building your project again go to your project folder and delete the .gradle folder from your project and then build your project.
Go to Publishing Settings/Build, enable Custom Gradle Template
Go to Assets/Plugins/Android/mainTemplate.gradle and change the postion from
buildscript {
repositories {
jcenter()
google()
}
to
buildscript {
repositories {
google()
jcenter()
}
Remove gradle cache and rebuild. For Mac you can run rm -rf $HOME/.gradle/caches/ in terminal.
Jcenter no longer hosts google dependencies, these can be resolved from "https://maven.google.com"
so you can simply add that to the resolvers list along with jcenter.
Regards,
Itamar
The problem is definitely having jcenter() above google().
However for me, my build.gradle was correct.
The problem happened because of one of my dependencies library had that problem.
The problem seemingly started happening out of nowhere, probably because my jar was cached.
I solved the problem by upgrading my problematic library to latest version as that contained a fix.
suddenly gradle is unable to build the same code that was working moments ago !
my project depends on google play service dependencies
it says :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
I think the aar file was removed from google by mistake
Does anyone have any idea, what is going on?
Add google() repository in your build.gradle. And check that google() is before jcenter().
The problem seems to be with jcenter. I have spent hours together with this problem and your problem seems to be similar to mine and I think the following solution should work.
For some reason and for many libraries in jcenter, the pom files of many libraries are kept in place but corresponding aar files have been removed. This is also the case with play-services-basement library. Check the following here for reference ( pom file of play-services-basement is available at jcentre here but aar file is not available at jcentre here):
Solution :
In your project level gradle file , change the following block of code
allprojects {
repositories {
jcenter()
google()
}
}
to
allprojects {
repositories {
google()
jcenter()
}
}
why this works ?
In our first code block, when gradle tries to resolve a dependency in the repository(in my case,it was google-services-basement in jcentre repository), it ddi not get resolved as corresponding aar files has been removed. As a result , build fails with something like :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
In our second code block, google repository has been referenced before jcenter repository. When gradle build starts, it looks first in the libraries listed first in repositories{... for resolving any library that is used in the project. Now, when gradle tries to resolve play-services-basement in jcenter, it is successful in resolving dependency as corresponding aar file has been made available by google repository(the same aar file of latest version is not available in jcenter repository) which has been referenced before jcenter repository is assessed. Do check and let me know if that works.
IN Worked
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
I am trying to add an external dependency from jcenter
compile 'com.droidninja:filepicker:2.0.4'
but I keep getting these errors and I can't figure out what is going wrong.
I have seen the same errors come up in lot of projects but nobody seems to know whats going wrong.
The problem is not with the dependency you just added but the Android Support library's dependencies. The latest SDK updates move towards using the remote Google Maven repository instead of downloading everything to be available locally. In order to fix dependency resolution problems follow the Adding Support Libraries guide. Really briefly this is what you have to do:
Open your project's build.gradle (note that this is not the module's file!)
Add the Google Maven repo to the project repositories:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
It's also recommended to add the repo to the buildscript block too, so later on the Gradle plugins can be downloaded from there too:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
All day I'm trying to add my Android library to Github with JitPack.
I did everything described on: https://jitpack.io/docs/ANDROID/, with no success.
The problem is, when i try to build project, Android Studio give me message:
Error:(47, 13) Failed to resolve: com.github.linean:btleuart:v1.0.0
Here is my repo: https://github.com/linean/btleuart
If anyone have any idea what should I check please tell me.
Sorry for my english :)
The release "v1.0.0" does not exist. The release name is "1.0.0". So, in your app or library gradle file, replace
compile 'com.github.linean:btleuart:v1.0.0'
by
compile 'com.github.linean:btleuart:1.0.0'
In addition, make sure that you have included JitPack repo in your root gradle file.
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
You can read some examples describing how to use JitPack to include libraries in your projects
I found solution !
Clean project
use /.gradlew build
use /.gradlew install
Compille project
Git - and now its working
Thanks cricket_007 for info about JitPack build log :)
main build.gradle file should have this:
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
you can check a working example here: https://github.com/matoelorriaga/pokemon-mvp/blob/master/build.gradle