DexArchiveBuilderException thrown if i add sourceCompatibility JavaVersion.VERSION_1_8 to gradle

So, we are using custom gradle for the project. Afther we updated unity 2018.3.4 we had an issue from versionCode and versionName. I saw this threat [BUG] Unity 2018.1.6f1 can't set versionCode & versionName to custom AndroidManifest.xml

Then i updated gradle template. After updating it started giving error during build process.

Error was

D8 Interface 'a placeholder name A' used as super class of 'a placeholder name B'
com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/ucankay/.gradle/caches/transforms-1/files-1.1/play-services-plus-10.2.1.aar/6f2c2ba1c2069e13e2a66258d80ce1c2/jars/classes.jar

After some research. I saw people are suggesting to add this part to gradle which is already there.

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

So i decided to remove instead. Than it build successfully and worked on device. I don’t know what was it but i hope that it doesn’t cause future errors.

I just wanted to inform you about that issue.

1 Like

please help me , on this issue step by step
Thanks

Are you using custom gradle template ? If yes

delete that code block from your template

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
1 Like