Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: DexMerge Failed #512

Open
asadqazi opened this issue Mar 8, 2024 · 11 comments
Open

Android: DexMerge Failed #512

asadqazi opened this issue Mar 8, 2024 · 11 comments

Comments

@asadqazi
Copy link

asadqazi commented Mar 8, 2024

I am adding the lib to my android project which has following gradle configuration:
build:gradle:7.4.2
But when I build the project I get following error

`> Task :app:mergeDexDebug FAILED
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"/Users/asad/.gradle/caches/modules-2/files-2.1/com.github.mwiede/jsch/0.2.16/18efa961263b774dc98ea267ab57f8aeaa4152b1/jsch-0.2.16.jar"}],"tool":"D8"}

Execution failed for task ':app:mergeDexDebug'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform jsch-0.2.16.jar (com.github.mwiede:jsch:0.2.16) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /Users/asad/.gradle/caches/modules-2/files-2.1/com.github.mwiede/jsch/0.2.16/18efa961263b774dc98ea267ab57f8aeaa4152b1/jsch-0.2.16.jar.
> Error while dexing.`

@mwiede
Copy link
Owner

mwiede commented Mar 11, 2024

I have setup an Android project and did not get this error.

Can you please give more information about source and target java version, JDK, etc.

Did you try to clear cache?

@asadqazi
Copy link
Author

asadqazi commented Mar 22, 2024

@mwiede
I created a new project and it is on gradle 8 it's working fine.
But for my existing project, with gradle 7 JSch the versions later than 0.2.12 are not working.
Here is my gradle:
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
com.android.tools.build:gradle:7.4.2
java version: jbr-17 JetBrains Runtime version 17.0.6

@norrisjeremy
Copy link
Contributor

I know little about Android development and Gradle, but it sounds to me like if Gradle 8.x works and 7.x doesn't, then perhaps you should be using 8.x?

@asadqazi
Copy link
Author

Is there any specific changes after 0.2.12 that gradle 7 does not support? I think JSch has nothing to do with gradle. It has dependency with Java version and I am using Java 17 which is OK.

@mwiede
Copy link
Owner

mwiede commented Mar 27, 2024

Maybe 17c93ea and gradle/gradle#27856

@IgeNiaI
Copy link

IgeNiaI commented Apr 8, 2024

I know little about Android development and Gradle, but it sounds to me like if Gradle 8.x works and 7.x doesn't, then perhaps you should be using 8.x?

Major gradle updates usually require major changes in gradle projects, especially on Android

@IgeNiaI
Copy link

IgeNiaI commented Apr 8, 2024

I am having a similar issue on gradle 7, gonna use 0.2.12 until it's fixed. My project is too big and updating gradle would be painful.

@norrisjeremy
Copy link
Contributor

I am having a similar issue on gradle 7, gonna use 0.2.12 until it's fixed. My project is too big and updating gradle would be painful.

It's unlikely that any "fix" for this will be coming from some future JSch release, as this is a Gradle problem, not a problem with JSch.

@wiedemam-VU
Copy link

@asadqazi @IgeNiaI Have you tried gradle 7.6.4 ?

@IgeNiaI
Copy link

IgeNiaI commented Apr 15, 2024

@wiedemam-VU nope, still fails

@cjcj125125
Copy link

I also encountered this problem in the latest version 0.2.20. How can I solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants