当前位置: 首页 > 知识库问答 >
问题:

错误:在android studio中执行任务“:app:TransformClassesWithDexForDebug”失败

东方灵均
2023-03-14
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
    applicationId "com.myapp"
    minSdkVersion 9
    targetSdkVersion 21
    multiDexEnabled true
}buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-project.txt', 'proguard-google-api-client.txt'
     }
   }
 }
 dependencies {
 compile 'com.android.support:support-v4:23.4.0'
 compile 'com.google.android.gms:play-services:+'
 compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.code.gson:gson:2.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/android-support-v7-cardview.jar')
compile files('libs/android-support-v7-recyclerview.jar')
compile files('libs/commons-logging-1.1.1.jar')
compile 'com.google.api-client:google-api-client:1.18.0-rc'
compile 'com.google.api-client:google-api-client-android:1.18.0-rc'
compile 'com.google.api-client:google-api-client-appengine:1.18.0-rc'
compile 'com.google.http-client:google-http-client:1.18.0-rc'
compile 'com.google.http-client:google-http-client-android:1.18.0-rc'
compile 'com.google.http-client:google-http-client-appengine:1.18.0-rc'
compile 'com.google.oauth-client:google-oauth-client:1.18.0-rc'
compile 'com.google.oauth-client:google-oauth-client-appengine:1.18.0-rc'
compile files('libs/google-api-client-gson-1.18.0-rc.jar')
compile files('libs/google-api-client-jackson2-1.18.0-rc.jar')
compile files('libs/google-api-client-java6-1.18.0-rc.jar')
compile files('libs/google-api-client-servlet-1.18.0-rc.jar')
compile files('libs/google-http-client-jackson2-1.18.0-rc.jar')
compile files('libs/google-http-client-jdo-1.18.0-rc.jar')
compile files('libs/google-oauth-client-java6-1.18.0-rc.jar')
compile files('libs/google-oauth-client-jetty-1.18.0-rc.jar')
compile files('libs/google-oauth-client-servlet-1.18.0-rc.jar')
compile files('libs/GraphView-4.0.1.jar')
compile files('libs/httpclient-4.0.1.jar')
compile files('libs/httpcore-4.0.1.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jetty-6.1.26.jar')
compile files('libs/jetty-util-6.1.26.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/jxl.jar')
compile files('libs/mail.jar')
compile files('libs/transaction-api-1.1.jar')
 }

共有1个答案

梁丘伟
2023-03-14

错误:任务“:app:TransformClassesWithDexForDebug”html" target="_blank">执行失败。com.android.build.api.transform.transformException:java.lang.runtimeException:com.android.ide.common.Process.processException:java.util.concurrent.executionException:com.android.ide.common.processException:org.gradle.Process.internal.execexception:Process“command”C:\program files\java\jdk1.7.0_79\bin\java.exe“已完成,退出值为非零1

上部的错误是由许多原因造成的。所以我可以提出为什么这个错误发生和如何解决它。

原因1:类文件名重复

解决方案:

当您将一些类文件重构为库项目时。并且当您写入类文件名称时,请再次检查您没有任何重复的名称

解决方案:

打开Task Manager并停止其他不常用的应用程序,这样就可以释放空间,解决outofmemory问题。

原因5:问题是您的方法计数超过了65k。

defaultConfig {
        ...
        multiDexEnabled true
    }
dependencies 
    {
       compile 'com.android.support:multidex:1.0.0'
    }
 类似资料: