Gradle doesn't find .aar file on Maven repo on Bintray - android

... even when the error reports the correct download URL.
(Bintray details below.)
Gradle Repo
repositories {
jcenter()
maven { url 'https://dl.bintray.com/myUsername/myRepo/' }
}
Dependencies
compile('com.domain.groupid:library-core:v1.2.3#aar') {
transitive=true
}
compile('com.domain.groupid:library-support:v1.2.3#aar') {
transitive=true
}
Error
Error:Could not find library-core.aar (com.domain.groupid:library-core:v1.2.3).
Searched in the following locations:
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/v1.2.3/library-core-v1.2.3.aar
If I copy that URL, I can download it in a signed out window. Why does Gradle have a problem with it?
There is another similar compile dependency (listed here as library-support), but I'm assuming it didn't get to it because this one failed first.
The setup...
I have a personal public repo on Bintray, with two android libraries.
https://bintray.com/myUsername/myRepo/library-core
https://bintray.com/myUsername/myRepo/library-support
Both have versions upload by the bintray rule in my library's gradle scripts. The versions upload, I can see them in the bintray UI, and I can download them and see that they are what I expected:
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/maven-metadata.xml
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3-sources.jar
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3.aar
https://dl.bintray.com/myUsername/myRepo/com/domain/groupid/library-core/library-core-v1.2.3/library-core-v1.2.3.pom
// Same for library-support. All of these download in a signed out window.
Is gradle expecting something else?

Maven usually doesn't expect the v prefix in the version attribute. It's implied by the order of coordinate syntax: <group>:<name>:<version>. Using semantic versioning for the version number should do the trick.

I had a similar issue, adding another answer to hopefully help others in the future.
In my case, I first only uploaded the .jar file to the maven repo, then when I uploaded the .aar file, it couldn't find it even though the error URL properly linked to the artifact.
Adding
--refresh-dependencies
to my gradle command fixed the issue for me

Related

How to hardcode actual path to a maven repository in Gradle, Android?

I have an strange issue. I just pulled our master branch and I am the only developer who get following error message among many Android developers in my company.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':bookingcore-android:debugCompileClasspath'.
> Could not find play-services-ads-identifier.jar (com.google.android.gms:play-services-ads-identifier:15.0.1).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-ads-identifier/15.0.1/play-services-ads-identifier-15.0.1.jar
we have following in root build.gradle file
repositories {
google()
jcenter()
...
}
and in one of our modules:
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
dependencies {
....
implementation "com.google.android.gms:play-services-ads-identifier:15.0.1"
}
Based on my search, actual maven path to play-services-ads-identifier.jar is https://mvnrepository.com/artifact/com.google.android.gms/play-services-ads-identifier/15.0.1. Is there anyway to tell gradle to download play-services-ads-identifier.jar from this link rather than google maven?
Based on my search, actual maven path to play-services-ads-identifier.jar is https://mvnrepository.com/artifact/com.google.android.gms/play-services-ads-identifier/15.0.1
No, that is a Web page. Among other things, it contains:
Note: this artifact it located at Google repository (https://maven.google.com/)
On my Android Studio 3.1.4 installation, like your coworkers, I am having no problems with:
implementation "com.google.android.gms:play-services-ads-identifier:15.0.1"
when I have google() listed in allprojects { repositories {} } in the root build.gradle.
For some reason, your Android Studio seems to think that this is a JAR, when it is really an AAR.
Tactically, you can force the issue, by changing the line to:
implementation "com.google.android.gms:play-services-ads-identifier:15.0.1#aar"
However, that is treating a symptom, not whatever the underlying problem is.
If you want to try fixing the underlying problem, try these:
If you have not done so already, do Build > Clean Project, and see if it picks up the AAR (I doubt that this helps, but it's always a good first step)
If that does not help, try File > Invalidate Caches/Restart, and see if it then picks up the AAR
You can try to clear the build cache if you are using Gradle 3.3 or higher, then see if it picks up the AAR
If that does not help, you can try closing Android Studio, renaming ~/.gradle/caches (or the equivalent on Windows) to something else, re-opening Android Studio, and seeing if it then picks up the AAR as it re-downloads all of your dependencies (if this works, you can delete the renamed directory; if it fails, you can always restore the renamed directory)

404 could not find resource lint-gradle-26.1.3.pom

trying to build a signed apk from a opensource android application and got the error for the link https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.3/lint-gradle-26.1.3.pom is not accessible
i try to put this link manually to my browser and after redirecting to https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/lint/lint-gradle/26.1.3/lint-gradle-26.1.3.pom?referrer link i got 404 could not find resource Error.
is something wrong with the repository? how can i fix this, i can reach the jar file from maven repository but gradle decides to get this from jCenter and hit this error and i can't remove jcenter from repository
I couldn't find out what is wrong but i find a workaround that sort of solve the problem.
I added this line to dependencies section of build.gradle file:
compile group: 'com.android.tools.lint', name: 'lint-gradle', version: '26.1.3'
somehow when gradle tries to fetch this jar in build process it fails and not going to fetch from google() repo (i have this in my repos) but it had no problem getting it when i specify it on dependencies. after it downloads i removed it from my dependencies and build used it's cached jar file and everything works now.

Failed to resolve github libraries Android gradle

In recent days I'm getting failed to resolve github libraries for so many popular libraries. I know it generally happens when the library is suspended or not available. But i tried it for so many libraries. And getting same result. But doesn't mean every libraries don't work. Some works.
For example..
I tried it for PhotoView..
compile 'com.github.chrisbanes:PhotoView:2.0.0'
In the release page the latest version was 2.0.0
I get same thing for so many other libraries. I think last week I updated the gradle. So is that why I'm getting this problem for some libraries..
Or what can be the problem..
I'm also using all maven urls for all libraries as mentioned in the docs file..
Make sure you added this root build.gradle file (Not your module build.gradle file):
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
FYI
New version has been released, You can try with
compile 'com.github.chrisbanes:PhotoView:2.1.3'
After that, Clean-Rebuild-Run.

Problems running Realm: Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT

I am trying to run the example projects from the Realm git repository using Android Studio.
I find that when I open any of the example projects I get the following error:
Error:Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/maven-metadata.xml
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.jar
file:/Users/username/.m2/repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/maven-metadata.xml
file:/Users/username/.m2/repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.pom
file:/Users/username/.m2/repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.jar
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.pom
https://jcenter.bintray.com/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/realm-gradle-plugin-0.88.0-SNAPSHOT.jar
Required by:
io.realm:adapterExample:0.88.0-SNAPSHOT
After some searching I found that someone else has encountered this issue previously and raised it as a git issue but can't understand how to implement the answer:
There is a chance our 0.88.0-SNAPSHOT hasn't been deployed yet. You
can install it yourself locally by running ./gradlew installRealmJava
from the root folder
The original user who asked the question doesn't confirm if this fixes his/her problem.
I have done further research on this solution which has lead me further and further from finding a solution as each problem requires further deviation from the original issue.
Considering this ticket is over a year old I am surprised that more people haven't come across the issue I have.
Any help or advice would be very appreciated.
Realm 0.88 has not been released to jCenter at the time of this writing (~9AM EST Feb 23 2016).
You can switch back to the latest build (0.87.4) by changing the contents of version.txt in the root directory. This, of course, will likely be missing some features so instead, as per the README you may want to add the OJO repository (and then you can use the 0.88-SNAPSHOT build):
If you want to test recent bugfixes or features that have not been packaged in an official release yet, you can use a -SNAPSHOT release of the current development version of Realm via Gradle, available on OJO
buildscript {
repositories {
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath "io.realm:realm-gradle-plugin:<version>-SNAPSHOT"
}
}
repositories {
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
Specifically, you must add:
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
to both the repositories nodes in the examples\build.gradle file (note I did this and successfully got the Realm-0.88-SNAPSHOT but then had a conflict with a support annotations library, so YMMV).

Gradle fails to find the dependency

I have used this tool to publish my library to sonatype https://github.com/chrisbanes/gradle-mvn-push. I can see that it's uploaded and signed correctly. but when I try to add the dependency to another project gradle can't find it
here is what i get: Error:Failed to find: com.github.mohd-bh:app:1.0.0
though I already included mavenCentral() in repositories block.
You can use this link http://search.maven.org/ to search the maven repository.
When I searched for your library, I could not find it.
Sonatype requires that you push your library from the staging server to the release server by using their website tool. You may not have done that which would result in the library not being published to maven.

Categories

Resources