I forked a project and imported it, but I cannot use it

Viewed 367

I'm very new to GitHub, so maybe it's something obvious, but I followed all the steps of many many websites (also the SO questions of course), but it doesn't work.


I need to change up this GitHub project. (Which is actually a fork of this one)

Importing the GitHub project via Gradle and using it works like a charm. So because I need some little changes, I followed these steps:

  • I forked it
  • I changed the code how I needed it
  • I made a new release (3.1.1): this is my fork

Then:

  • I added maven { url "https://www.jitpack.io" } to my root gradle
  • I imported my fork in the app gradle: implementation 'com.github.tabkus:odomacrop:3.1.1'
  • I synchronized gradle
  • The importing of my fork seems to work fine because it doesn't show an error and it downloads a lot of data

But: I cannot use the code. I cannot import the classes. In this case I need for example the class UCrop as in the code

UCrop.of(...)
      .withMaxResultSize(1080, 1080)
      .start(activity);

But I cannot import it. I cannot import any class. I also tried Invalidate caches and restart in Android Studio but that didn't help either...

It simply says: Cannot resolve symbol 'UCrop'

img

EDIT:

I followed the answer and it solved an error. But it still didn't work. So I checked it on jitpack.io . The error now is Execution failed for task ':ucrop:signReleasePublication'. > Could not read PGP secret key. I looked it up on the internet but I couldn't find a fix for that. I assume some of the Gradle settings shall include some signing key and mine lack such a key. But since it is a fork, my Gradle files are exactly the same files. (I only made minor changes to some java.classes) jitpack.io/com/github/tabkus/odomacrop/2.2.7-2/build.log

2 Answers

Well...

  1. Do not trust Android Studio sync, it sometimes does not popup errors for u
  2. Using Gradle CLI directly to run a simple "assmeble" task like ./gradlew clean assembleDebug for an Android project.(Add -s to show more stacktrace if necessary)
  3. In my case above command threw an error below:

> Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

  1. Now the problem is obvious: your JitPack release got some problem absolutely. So I went to https://jitpack.io/#tabkus/odomacrop to check status:

enter image description here

  1. Click the log icon, you will see the root cause:

enter image description here

Assuming you see as error message:

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app

Check first if this is similar to Yalantis/uCrop issue 779 -with Yalantis/uCrop being the original project)

you just move:
maven { url "https://jitpack.io" } from build.gradle (Project) to settings.gradle

dependencyResolutionManagement {
   repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
   repositories {
       google()
       mavenCentral()
       jcenter()
       maven { url "https://maven.google.com" }
       maven { url "https://jitpack.io" }
   }
}
rootProject.name = "<Project Name>"
include ':app'
Related