简体   繁体   English

Gradle构建失败,出现TransformException

[英]Gradle build failing with TransformException

My gradle.build file looks like this: 我的gradle.build文件如下所示:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"

        defaultConfig {
            applicationId "com.example.alexandernohe.mapsappgoogle"
            minSdkVersion 16
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.2.1'
        compile 'com.google.android.gms:play-services:8.4.0'
        compile 'com.google.maps.android:android-maps-utils:0.4.3'
        compile 'com.firebase:firebase-client-android:2.5.1+'
        compile 'com.android.support:support-v4:23.2.1'
        compile 'com.android.support:design:23.2.1'

    }

I have enabled multidexing and have tried deleting the app/build folder but my application still will not build. 我启用了多点排序,并尝试删除了app / build文件夹,但是我的应用程序仍然无法构建。 If I remove the design library it will build but then I am unable to use a floating action button in my fragment, nor a coordinated layout. 如果删除设计库,它将建立,但是我无法在片段中使用浮动操作按钮,也无法使用协调的布局。 Most of the current solutions on here reference posts to enable multidexing, however, looking at the build file, you should see that it is enabled. 此处的当前大多数解决方案参考文章来启用多义处理,但是,查看构建文件,您应该看到它已启用。 I have a feeling that a library listed may overlap with the design library but as far as I can tell based upon googles documentation, they are different. 我感觉列出的库可能与设计库重叠,但是据Google文档判断,它们是不同的。

Here is the error code: 这是错误代码:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 错误:任务':app:transformClassesWithDexForDebug'的执行失败。 >com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3 > com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'command'/Library/Java/JavaVirtualMachines/jdk1.8.0_45 .jdk / Contents / Home / bin / java''完成,退出值非零3

EDIT: I forgot to mention, I have also performed a clean on the project as well. 编辑:我忘了提,我也对该项目进行了清理。

Try this inside the android block of your build.gradle: 在build.gradle的android块中尝试以下操作:

dexOptions {
    javaMaxHeapSize "4g"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM