Java finished with non-zero exit value 2 - Android Gradle

前端 未结 23 2699
甜味超标
甜味超标 2020-11-22 02:54

I\'m getting this error executing my Android app (I cleaned it and then built it, but the error is still present)

  • Sync: OK
  • Make Project: OK
23条回答
  •  醉梦人生
    2020-11-22 03:18

    This issue is quite possibly due to exceeding the 65K methods dex limit imposed by Android. This problem can be solved either by cleaning the project, and removing some unused libraries and methods from dependencies in build.gradle, OR by adding multidex support.

    So, If you have to keep libraries and methods, then you can enable multi dex support by declaring it in the gradle config.

    defaultConfig {        
        // Enabling multidex support.
        multiDexEnabled true
    }
    

    You can read more about multidex support and developing apps with more than 65K methods here.

提交回复
热议问题