1

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

mathematics-and-caffeine
  • 1,664
  • 2
  • 15
  • 19

2 Answers2

1

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

2BAB
  • 1,215
  • 10
  • 18
  • Thanks, that helped a lot. I now fixed these issues and created a new release. It doesn't work either. So I checked it on jitpack.io as you did. The error now is `Execution failed for task ':ucrop:signReleasePublication'. > Could not read PGP secret key` I looked it up in 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) https://jitpack.io/com/github/tabkus/odomacrop/2.2.7-2/build.log – mathematics-and-caffeine Jan 09 '22 at 08:17
  • The original repo published to MavenCentral, it gets signing key/value from rootProject‘s ext: https://github.com/tabkus/odomacrop/blob/master/ucrop/publish.gradle#L70 MavenCentral requires signing configuration, while jitpack I think does not, you can remove those configurations (publish.gradle line 2, 68-74). You MUST check it locally as its doc mentioned: https://jitpack.io/docs/ANDROID/ `./gradlew publishToMavenLocal`. What's more, I suggest you change the group name of https://github.com/tabkus/odomacrop/blob/master/ucrop/build.gradle#L5 to avoid getting someone else confused. – 2BAB Jan 09 '22 at 08:57
  • If any other issues happen, I suggest you close this one and create another question, because comments have characters limitation and can not post images. – 2BAB Jan 09 '22 at 08:59
0

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'
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I'm not sure which error you mean. I don't get an error. I just cannot import the class, it says `Cannot resolve symbol 'UCrop'`. I updated the question and attached a screenshot. I think I didn't explain good what the issue exactly was – mathematics-and-caffeine Jan 09 '22 at 00:16
  • However, if I try what you suggested it fails to sync gradle with this message: `Could not find method dependencyResolutionManagement() for arguments [settings_33sy7yotaht14ypku7jp6tfyq$_run_closure1@3de9ca5] on settings 'ProjectName' of type org.gradle.initialization.DefaultSettings` – mathematics-and-caffeine Jan 09 '22 at 00:18
  • @LukasNiessen OK. I would still suggest looking into those settings, but I don't know gradle enough to bring new advice. – VonC Jan 09 '22 at 01:11
  • Well these 2 DSLs of maven central declaration are equivalent, should not be the cause of error. – 2BAB Jan 09 '22 at 02:31