java - Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

标签 java android android-studio

当我尝试使用Android Studio运行应用程序时,出现以下异常:

Error:Execution failed for task ':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_05\bin\java.exe'' finished with non-zero exit value 2

最佳答案

我有一个相同的问题,经过几个小时的研究,我找到了解决问题的解决方案。

您应该修复 build.gradle :

android {

    compileSdkVersion ..
    buildToolsVersion '...'

    defaultConfig {
       ...
       targetSdkVersion ..
       multiDexEnabled true  // this line will solve this problem
   }
}

If the number of method references in your app exceeds the 65K limit, your app may fail to compile.



有关如何执行此操作的信息,请参见Selectively compiling APIs into your executableBuilding Apps with Over 65K Methods

关于java - Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38209505/

相关文章:

Android导航栏全隐藏

android - Google Analytics 减慢 Android 应用程序速度

android - "Highgui.imread"命令对 OpenCV Android 不起作用

android - build.gradle(项目)和 build.gradle(模块)之间的区别

java - Android 应用程序在启动时崩溃,代码为 "E/dex2oat: Failed to create oat file"和 "non-0 exit status"

java - 找不到带有 URI 的 HTTP 请求的映射

java - 将数字 (22,21) 映射到 BigDecimal 时,Hibernate 在结果中丢失精度

java - 在 Java 中重命名 eXist-db 中的集合

git - 当我在 Android Studio 4.1 中使用 Git 时,如何显示所选文件的所有分支中的所有历史文件

java - 如何在JSTL if语句中执行按位逻辑?