Error Gradle Build C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

前端 未结 6 1211
太阳男子
太阳男子 2020-12-21 14:08

Error:Execution failed for task \':app:transformClassesWithDexForDebug\'. com.android.build.api.transform.TransformException: com.android.ide.common.process

6条回答
  •  失恋的感觉
    2020-12-21 14:35

    I faced the same issue. Scrolling down, I found the following error in the logs:

    java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

    Then I searched for the above error and found the following work-around as suggested by the solutions to this question and another similar question:

    In the file build.gradle(Module:app) I changed the following from:

    buildToolsVersion "24.0.0"

    to

    buildToolsVersion "23.0.2"

    and clicked the button to "sync project with gradle files" in Android Studio and the error vanished.

    Note: I didn't understand the exact reason for the error and it's solution completely but it seems to be a compatibility issue of java version 1.7 and Android API level 24. Some people suggested (on the questions' links I mentioned) to use JDK version 8 with API 24, or downgrade it to JDK version 7 and API level 23.0.x as a work around.

提交回复
热议问题