Android Studio: Unexpected top level exception (finished with non-zero exit value 2..)

独自空忆成欢 提交于 2019-11-27 22:22:49

Just had the issue yesterday. I fixed it by manually removing the build/ and app/build/ folders, and by building the project again.

But it also might come from something else like your app reaching the 65k methods limit (in what case "Configuring Your App for Multidex with Gradle" will fix your issue). So you will need to provide the full Graddle log for us to be able to check more in detail what the issue could be.

s-hunter

I had the same issue, solved it by doing the following

In the app build gradle file, inside android: add in defaultConfig:

multiDexEnabled true

and add this in the android:

dexOptions {
    javaMaxHeapSize "4g"
}

Ref: https://stackoverflow.com/a/25006428/2069407

At my case change buildToolsVersion from "24" to "23.0.2", solve the problem especially if you're using old Android Studio less than version 2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!