Java repo jitpack error help #183996
Replies: 4 comments
-
Root Cause: Gradle ↔ Protobuf Plugin Version IncompatibilityThis error is a known Gradle compatibility issue. JitPack typically builds with newer Gradle versions (7.x or 8.x). Older Protobuf plugins rely on internal Gradle APIs (such as Solution: Align Protobuf Plugin, Gradle, and JDK VersionsUpdate the Protobuf Gradle Plugin (Required)If you are using an older Protobuf plugin, update it to a compatible version. Using plugins {
id "com.google.protobuf" version "0.9.4" apply false
}Using buildscript {
dependencies {
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.4"
}
}Version compatibility guidance:
Verify Your Gradle Wrapper VersionCheck: Example (Gradle 8.x): distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zipIf this is Gradle 8.x, you must use Protobuf 0.9.x or newer. Pin the JDK Version for JitPack (Highly Recommended)JitPack may use a different Java version than your local environment. jdk:
- openjdk17
install:
- ./gradlew installUse Force a Clean JitPack BuildJitPack caches failed builds. To clear it:
Why This HappensThe stack trace: indicates the Protobuf plugin is calling Gradle internal APIs. Summary
This resolves the issue in the majority of JitPack + Android + Protobuf builds. |
Beta Was this translation helpful? Give feedback.
-
|
This issue is caused by a tooling mismatch rather than a problem with the project’s source code. The error occurs when JitPack tries to apply the com.google.protobuf Gradle plugin using a Gradle version that is incompatible with the version of the Protobuf plugin declared in the project. The Protobuf Gradle plugin depends on internal Gradle APIs, and when JitPack uses a different Gradle version than the one used locally in Android Studio, those APIs may not exist or may have changed, resulting in the ProtobufSourceDirectorySet constructor error. This explains why some versions of the repository build successfully while others fail or only partially generate artifacts. The solution is to explicitly align the build tool versions by pinning a Protobuf Gradle plugin version known to be compatible (for example com.google.protobuf:protobuf-gradle-plugin:0.8.17), committing a Gradle wrapper that forces a supported Gradle version (such as Gradle 6.9.3), and optionally specifying the JDK version for JitPack using a jitpack.yml file. Once the Gradle, Protobuf plugin, and JDK versions are aligned, the project builds correctly on JitPack. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you both! I have seen similar solutions and can't seem to figure any of them out. I'm pretty new with java/gradle so forgive me. Comparing two versions, the one that compiles fine is using pom.xml in the folders and the other that is not is using gradle.build files. I have tried switching out the build.gradle files with the pom files but doesn't seem to help. |
Beta Was this translation helpful? Give feedback.
-
|
New update, after switching to pom.xml from a known good compile, it has come a long way but I am now getting different errors. I'm guessing it is now due to a mismatch in protobuf and another dependency but it is using proto 2.6.1 like the known good versions. https://github.com/HoursDEV01/hoursjv3/blob/litecoin-0.15.1/core/pom.xml [INFO] ------------------------------------------------------------- |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
We have cloned a java repo and made some minor changes in some parameters but are having issues compiling them using jitpack. Below is the error in the log of the build. I know it seems straight forward but everything I have found online doesn't seem to be helping. Some versions of the repo will compile fine and others will compile but only download some of the files into Android Studio. I am a bit new to Android/java so any help would be great.
A problem occurred evaluating project ':core'.
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions