java - Realm 和 jackOptions Java 以非零退出值 1 完成 - Android Gradle

标签 java android intellij-idea android-gradle-plugin build.gradle

升级到 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/

相关文章:

java - 在 JSF 2.0 中使用@ViewScoped?

java - 如何在 Play framework 2.5 中读取属性文件

java - 如何使用 Java 向 EMS Topic 发布消息

android - Gradle 代码未构建 : aidl is missing

java - 渐变 + 想法 : can not resolve systemProperty in build. 渐变

java - 纯 GWT,事件转换

带有自定义图像和进度指示器的 Android 加载进度条

android - 更改在 Android Studio 中选择的 TabLayout 的颜色

Android Studio 在共享测试目录中显示未解析的引用,但执行任务按预期工作

scala - Intellij IDEA - 输出路径 ...\project\target\idea-classes 与源根目录​​相交。仅清理由构建创建的文件