JitPack won't use a GitHub repo - included sample repo that demonstrates the issue
Asked Answered
S

1

4

Every time I try to fork an Android library and use it through JitPack, I get errors, give up and choose some other means to customize and use the library. This time I wanted to get to the bottom of this and created a basic app that isolates the problem. Could you download the repo below and tell me what the I'm doing wrong?

In this repo is a very basic Android application: https://github.com/gazialankus/JitpackNotWorking. I simply created a new Android application in Android Studio, and followed the instructions in https://jitpack.io/ to add the https://github.com/ArthurHub/Android-Image-Cropper github repo as a dependency. I added the JitPack Maven repository in the root build.gradle and added the library dependency in the app build.gradle like this:

compile 'com.github.ArthurHub:android-image-cropper:2.4.5'

Gradle syncs fine, but android-image-cropper-2.4.5 does not show up under external libraries in project view. So, the app won't build with this error:

Error:(6, 38) error: package com.theartofdev.edmodo.cropper does not exist

As I noted in the comments in the app build.gradle, using the library without JitPack like this works just fine:

compile 'com.theartofdev.edmodo:android-image-cropper:2.4.5'

I thought maybe JitPack could not build this repo. However, the JitPack log for this repository says "ok".

Gradle and Java versions: In Android Studio menu File > Project Structure > Project, the Gradle version is 3.3 and the Android Plugin Version is 2.3.3. In the same dialog, SDK Location tab shows that embedded JDK is being used from C:\Program Files\Android\Android Studio\jre.

> "C:\Program Files\Android\Android Studio\jre\bin\java.exe" -version 
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)

There are no pending updates in Android Studio.

Could you please download and build this repo that isolates the problem and tell me what I'm doing wrong? Again, the repository that demonstrates the problem is here: https://github.com/gazialankus/JitpackNotWorking

Thank you.

Edit: Tried with a fork of mine and tried to make the library more JitPack-friendly, still the same issue. Please see the commits in the repo.

SOLVED: Please see https://github.com/gazialankus/JitpackNotWorking/blob/master/README.md for more details.

Siphonostele answered 30/6, 2017 at 7:53 Comment(15)
I'm checking now.Periodical
What is your java version ?Ruthannruthanne
I added information about the Java version. It's the JDK embedded in Android Studio, which is openjdk version "1.8.0_112-release".Siphonostele
I can confirm that it does not download the dependancy, not displaying eny error message. I checked with other dependancies from jitpack, which already were included into my project, and it themes that only this one is not being downloaded. I think you need to contact Jitpack.io as it does not look like you-only problem.Periodical
what about in configuration ? i.stack.imgur.com/jEm7C.pngRuthannruthanne
ToYonos, does it work for you?Siphonostele
No i did not test it, not the time right now but i have a hunch about a java version issueRuthannruthanne
I used the JDK in C:\Program Files\Java\jdk1.8.0_131, followed by a gradle sync and rebuild. Still, the same issue persists.Siphonostele
Could you try in full lower case ? compile 'com.github.arthurhub:android-image-cropper:2.4.5'Ruthannruthanne
Just look at the build log guys, the project is simply not JitPack compatible and I'm not even using JitPack for anything.Ingratitude
(for the record, lower case did not help neither in embedded nor in external jdk)Siphonostele
Just curious, haven't you try following the Android jitpack.io tutorial at jitpack.io/docs/ANDROID?Agrobiology
This is not my library and I tried to use the developer's github repo. However, I did fork it later and added the lines in that link and it didn't seem to work with master-SNAPSHOT that way. Now I'll try adding a tag and troubleshoot the issues that Vampire raised in the logs.Siphonostele
Maybe you forget to create a tag from the latest commit. jitpack.io use the release tag as the library.Agrobiology
Yes, the tag was the finishing touch that made it work. Thanks!Siphonostele
I
2

I think the problem is the group and version.

In the build log you can see that in the Gradle call there is contained -Pgroup=com.github.ArthurHub and -Pversion=2.4.5. But also in the log you see Found artifact: com.theartofdev.edmodo:android-image-cropper:2.4.5-SNAPSHOT where it actually should be Found artifact: com.github.ArthurHub:android-image-cropper:2.4.5.

You also see in the list of files in the bottom of the log that only the POM is produced, no jar or aar. That's also why the Gradle sync is successful in AS, as the dependencies pom is found and valid, there is just no artifact for that dependency.

If you look at the build.gradle of the project you are referring, you can see that they do not use group and version for configution the publication, so what JitPack has set is not used and thus cannot be found.

That project simply is not JitPack compatible as long as JitPack does not get more intelligent and instead of just setting some project variables adds some init script that reconfigures publications or something like that.

Maybe you should use a composite build instead. With a composite build you would declare a binary dependency like com.theartofdev.edmodo:android-image-cropper:2.4.5, but then substitue this dependency by the worktree of the project and a sub-build is automatically done to get the artifact for the dependency. That's the pure Gradle way to replace a dependency with a custom build one.

Ingratitude answered 30/6, 2017 at 9:23 Comment(5)
Every time I try to fork an Android library and use it through JitPack, I get errors, give up and choose some other means to customize and use the library. : it means many libraries are not JitPack compatible and Gazi Alankus is just out of luck ?Ruthannruthanne
I guess so, but I can only speak about this example here.Ingratitude
I'm not 100% sure but looking back at previous projects, I think these were the two other times that could not use JitPack similarly and ended up adding the library code to my project: github.com/Nexmo/verify-android-sdk and github.com/rameshvoltella/RWeekCalendar (latter is probably a bad example anyway). So now I will try to make a fork of this image cropper that is JitPack compatible based on Vampire's suggestions. Highly appreciated!Siphonostele
Neither version 2 nor 3 of Nexmo/verify-android-sdk even build in JitPack as you can see in its log. The three snapshot builds of rameshvoltella/RWeekCalendar look like they should have been worked and be usable.Ingratitude
SOLVED. Thank you Vampire! I documented the solution here: github.com/gazialankus/JitpackNotWorking/blob/master/README.md All the issues that you wrote were spot-on! (Except I didn't have to do anything about version.)Siphonostele

© 2022 - 2024 — McMap. All rights reserved.