0

I have created an android library and published it in Jitpack.

Currently, my build is getting success in Jitpack. but when I add the implementation URL in my project build Gradle gets success but when I try to use library classes it does not get resolved

In the external library tab located in the project structure, it does not have the library which I have implemented so might be .jar file is not getting generated.

Help me If you have any solution or any way to identify this issue.

2 Answers2

0

If I understand correctly you say that the gradle build or 'project sync' after a change in the gradle files works fine. But you cannot use any of the code from your library.

Can you verify that your library is loaded in the External Libraries? It would be something with your repository name in it and ends with '@aar' (eg. com.github.nickname:libraryname:version@aar)

If you cannot find it, please check if your library module build.gradle has the line below somewhere at the top of the file.

apply plugin: 'com.android.library'
SvdTweel
  • 172
  • 1
  • 2
  • 11
  • Correct i can't find @aar file in External Libraries and i have checked apply plugin is there in my library project Also, while building project on jitpack console i am not getting -sources.jar after Build success – Mohit Dholakia Nov 23 '21 at 15:53
  • Do you see the 'build artifacts' step in your log? Because that one should result in -sources.jar, -.aar, -.pom etc. And do you have a github repo for your library? Because then you probably also should have this plugin in your module build.gradle: "apply plugin: 'com.github.dcendents.android-maven'" – SvdTweel Nov 23 '21 at 16:01
  • Yes Build artifacts: is there at the end and after that i am having various files generated like aar, log, log, module, pom, pom.md5, pom.sha1 but jar is not there – Mohit Dholakia Nov 23 '21 at 16:04
  • The other files seems fine. Do you have the "classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'" in your project build.gradle and the "apply plugin: 'com.github.dcendents.android-maven'" in your module build.gradle? See also [demo project](https://github.com/jitpack/android-example#adding-the-maven-plugin) – SvdTweel Nov 23 '21 at 16:13
  • i have tried adding "classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'" but if i add "apply plugin: 'com.github.dcendents.android-maven'" it gives error as it is not supported link : https://stackoverflow.com/questions/68609209/unable-to-load-class-org-gradle-api-publication-maven-internal-mavenpommetainfo – Mohit Dholakia Nov 23 '21 at 16:26
  • Maybe it has something to do with the abandoning of the plugin, in the link you've posted they say you have to downgrade. If that is not an option please check the [new plugin](https://developer.android.com/studio/build/maven-publish-plugin) or this [migration page](https://medium.com/@Wingnut/migrating-android-maven-gradle-plugin-to-maven-publish-using-jitpack-9a3470c3759f) to use the new plugin instead of the deprecated one. – SvdTweel Nov 23 '21 at 16:32
0

The issue was the Repository was private so we need to provide an authentication token. The reference link is given below

https://jitpack.io/docs/PRIVATE/