Home » Android » app transformClassesWithDexForDebug

app transformClassesWithDexForDebug

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am using Android Studio 2.3.3 with java 8 in macOS. Im trying to clone this project. I have check out the code, I build it successfully but I get an error when I run the app. The error that I am getting is

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 53 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.

And in gradle console I see

Execution failed for task ‘:app:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex ‘/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.8.0-beta0/f90ef27de5a997d30c169cb706835e32d724ca96/slf4j-api-1.8.0-beta0.jar’ to ‘/AndroidStudioProjects/smpp-server-android/app/build/intermediates/transforms/dex/debug/folders/1000/10/slf4j-api-1.8.0-beta0_46879b9c3f1d19f1faafccf7c4ba82d4eacf2a14’

I have try to build it with multiDexEnabled true, I have clean and rebuild the project, also I tried from terminal gradlew clean, I tried invalidate cache & restart, I added

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

but no luck. In addition, I downloaded Android Studio 3 but still I can’t run the project.

Answers: