升级到 Android design tools 24 后,我的项目将不再运行。它构建得很好,没有任何错误,但是当我运行它时,我收到错误:
错误:Gradle:任务“:app:transformClassesWithDexForDebug”执行失败。
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_102\bin\java.exe'' finished with non-zero exit value 1
这是我的 build.gradle 文件:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.don.mstp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.Lukle:ClickableAreasImages:v0.1'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.github.javiersantos:MaterialstyledDialogs:1.3'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'com.github.brnunes:swipeablerecyclerview:1.0.2'
compile 'com.github.gabrielemariotti.recyclerview:recyclerview-animators:0.3.0-SNAPSHOT@aar'
compile 'com.tiancaicc.springfloatingactionmenu:library:0.0.2'
compile 'com.daimajia.numberprogressbar:library:1.2@aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.daprlabs.aaron:cardstack:0.3.0'
compile 'com.txusballesteros:FitChart:1.0'
compile 'com.github.SilenceDut:ExpandableLayout:v1.0.1'
}
最佳答案
我终于让我的项目运行起来了,方法如下:
显然,目前无法将 Jack 编译器与 Realm 一起使用,因为 Jack 不支持字节码操作(Javassist/Transform API)。话虽这么说,但我们现在可以使用“retrolambda”并删除 jackOptions。
在你的build.gradle中
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
在项目主gradle中添加类路径:
dependencies {
classpath 'io.realm:realm-gradle-plugin:0.88.3'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
这让我的项目再次运行。
关于java - Realm 和 jackOptions Java 以非零退出值 1 完成 - Android Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39401895/