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.
Related
... 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
I have a project hosted on GitHub at https://github.com/BoardiesITSolutions/NavigationDrawerManager.
I've seen some projects on GitHub state adding it to their gradle file in Android Studio to the dependencies section but this doesn't seem to be working for me.
I have tried compile: 'com.github.boardiesitsolutions.NavigationDrawerManager:+' but it keeps saying it can't find it, I've also tried replacing the + with the version number but no luck, Android Studio keeps saying it can't find it. I've added the repository MavenCentral as well.
Is there something I need to do from GitHub to make it accessible for Gradle?
I don't see it on maven.
You can use this website to use non-mavenized libraries with Gradle.
Just add maven { url "https://jitpack.io" } to repositories section of build.gradle and use compile 'com.github.BoardiesITSolutions:NavigationDrawerManager:0b14c84445' in dependencies.
I have a repository on Github, I would like to use my repository in Android Studio using: dependencies {compile 'com.google.code.gson: Gson: 2+'} for gradle. Does someone know how to do this?
You could use JitPack.io to expose your repository as a Maven dependency. Then including it in Android Studio is easy with gradle:
compile 'com.github.YourUsername:RepoName:ReleaseVersion'
There are more instructions on the website.
I don't know if I really got the question...I understood that you want to compile some jar files that are not local to your project and are hosted in your repository. If it is the matter, I guess you should use a custom maven repository, not a Github one. If this is the problem I can give you more details on how to create a custom maven repo.
It's like #dometheshooter said.
See:
How to publish aar file to Apache Archiva with Gradle
Guide to publish an aar to maven using gradle
How to deploy JAR to Maven remote repository
Guide to uploading artifacts to the Central Repository
Guide to deploying 3rd party JARs to remote repository
I made a android library in github that i want to add to Gradle,
that other people can add
compile "my project ..."
to there android build.
how can i upload it to Gradle?
(I didn't find an answer for this anywhere)
EDIT:
To clear my question, I want to release a library for developers.
Thanks
You don't "upload a library to gradle" ;-), you make it accessibla via gradle, so you first have to compile your library and publish the generated artefacts (aar or jar files) to a central repository, like Maven Central.
There are two common Maven repositories at time of this writing:
Maven Central http://search.maven.org/
JCenter https://bintray.com/bintray/jcenter
See this guide as a direction for mavenCentral:
http://www.vandalsoftware.com/post/52468430435/publishing-an-android-library-aar-to-a-maven
Since recent Android Studio versions, JCenter is the preferred default repository, so you may register there and upload your archives to it, like explained here:
https://www.virag.si/2015/01/publishing-gradle-android-library-to-jcenter/
Hope that helps.
The easiest way to expose your library to other developers is by using the JitPack service.
The requirement is that you create a GitHub release and that you have a build file in your repository. It doesn't require that you upload your library.
I have never used Maven before.
I am following these instructions to setup google-api-client-java for Android.
I have also checked out the sample applications and trying to build calendar-android-sample but getting some Maven related errors.
Are there any other steps to integrate google api's ?
I have these errors -
The container 'Maven Dependencies' references non existing library 'C:\Users\Salil.m2\repository\com\google\apis-samples\shared-sample-calendar\v2-1.1.0\shared-sample-calendar-v2-1.1.0.jar'
Error resolving version for plugin 'org.apache.maven.plugins:maven-deploy-plugin' from the repositories [local (C:\Users\Salil.m2\repository), central (http://repo1.maven.org/maven2)]: Plugin not found in any plugin repository
Error resolving version for plugin 'org.apache.maven.plugins:maven-deploy-plugin' from the repositories [local (C:\Users\Salil.m2\repository), central (http://repo1.maven.org/maven2)]: Plugin not found in any plugin repository
I think is more simple to just add the dependencies jars into your lib folder(from your project) and then add the lib folder to your dependencies path(you do this using your IDE).