首頁>Program>source

当我尝試使用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

最新回復
  • 5月前
    1 #

    我遇到了同樣的問题,经過几个小時的研究,我找到了解決問题的解決方案。

    您應该修複 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.

    有關如何執行此操作的資訊,請參阅使用Android Studio 2.0 Preview 4選擇性地將API編譯到可執行檔案和使用超過65K的方法構建應用程式

  • 5月前
    2 #

    我突然遇到了這个問题並添加了 multiDexEnabled true 没有帮助,而且清理和重建也没有帮助。

    所以為我解決的唯一一件事就是删除该檔案:

    YOUR_APP_NAME\app\build\intermediates

    並執行该應用程式,它便可以正常工作。

  • 5月前
    3 #

    修改模組級build.gradle檔案

    android {
        ...
        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
    

    }

    添加依赖項 編譯'com.android.support:multidex:1.0.0'

    在清單中添加MultiDexApplication類

    <manifest ...>
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
    

    http://developer.android.com/studio/build/multidex.html

  • 5月前
    4 #

    對我来說,關闭所有其他Android Studio即可解決問题。

    出現錯誤時,我開設了3个android工作室,關闭2个工作室後,我没有任何錯誤。

    無需添加与multiDex相關的任何代碼!

    似乎存在与jvm相關的記憶體問题。

  • 5月前
    5 #

    只需解決此問题.就我而言,重建專案對我有帮助。 因此,尝試重建您的專案。

  • c#什麼時候應该使用列表,什麼時候應该使用arraylist?
  • c#:靜態和例項方法同名?