繁体   English   中英

android gradle构建错误?

[英]android gradle build error?

错误:任务':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.7.0_79\bin\java.exe'' finished with non-zero exit value 3
Information:BUILD FAILED
Information:Total time: 1 mins 34.319 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

如果仍然出现错误,那么您必须使用给予multidex支持

只需添加以下gradle依赖项

  compile 'com.android.support:multidex:1.0.1'

然后创建这样的应用程序类

public class ApplicationClass extends Application {
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}}

并在应用程序gradle defaultConfig部分中添加

   multiDexEnabled true

清单文件中的最后一件事添加应用程序类:

   android:name=".application.ApplicationClass"

在您的应用程序中Build.gradle

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "at.navigationdrawer"
        minSdkVersion 11
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"



        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

只需添加multiDexEnabled true即可,无需更多代码即可解决此问题

暂无
暂无

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

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