I tried to add a module to an Android project and make the main module dependent on it and I got this error:
Error:Gradle: Execution failed for task ':app:preDexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 1
I have a project with the main module app and added a module mylib and app depends on mylib.
Android Studio 1.2.2.
settings.gradle:
include ':app', ':mylib'
build.gradle from app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
compileOptions {
sourceCompatibility org.gradle.api.JavaVersion.VERSION_1_8
targetCompatibility org.gradle.api.JavaVersion.VERSION_1_8
}
...
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':mylib')
}
build.gradle from mylib:
apply plugin: 'java'
sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_8
targetCompatibility = org.gradle.api.JavaVersion.VERSION_1_8
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
The JAVA_HOME variable:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
The problem starts when I add line compile project(':mylib') to build.gradle, sometimes when I rebuild the project, but always when I try to run it. The VERSION_1_8 statements don't solve the problem.
What can be wrong? Any help will be very much appreciated.
Aucun commentaire:
Enregistrer un commentaire