0
When compiling, the following error occurs:
:app:transformClassesWithDexForDebug FAILED
Error:1 error; aborting
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 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.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 1
build.Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
//compile 'com.android.support:support-v4:22.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
}
}
allprojects { repositories { jcenter() } }
task clean(type: Delete) {
delete rootProject.buildDir
}
Can show code where error occurs?
– Jorge B.
The error tells you how to solve: add
targetCompatibility = '1.7'
andsourceCompatibility = '1.7'
at the build.Gradle.– ramaral
@ramaral I already updated the question showing how this mine
build.fgradle
. After adding the following error occurredError:(11, 0) No such property: targetCompatibility for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated
<a href="openFile:C:\Users\LordLokon\Desktop\Arquivos\Work Android\HorarioEscolaApp\build.gradle">Open File</a>
– Lucas Caresia
It is not in this Gradle but in the module and this way:
compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }
. Still I can’t guarantee it’s enough.– ramaral
@ramaral Could you send me the complete file (for download or writing), please ??
– Lucas Caresia
The content of the file is different in each project. You have to post yours so we can try to figure out where the problem is.
– ramaral