Android Studios RuntimeException: Unexpected exception in dex writer thread

你离开我真会死。 提交于 2019-12-03 09:45:16
Simon

After googling for a while, I found the problem was that not enough heap was allocated to the dex writer.

I fixed it by putting in the following in my app gradle.build:

android {
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}

This option also managed to speed up my gradle build significantly.

Extremely long build with Gradle (Android Studio)

Adding this to my Project level gradle.properties helped -

org.gradle.jvmargs=-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

change your manifist to this

defaultConfig 
{
    applicationId "com.example.simon"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    /*Enabling multidex*/
    multiDexEnabled true
}
android {
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}

dependencies {
    /*    Enabling multidex*/
       compile 'com.android.support:multidex:1.0.1'
}

and this problem shows when you add the :

/*Enabling multidex*/
    multiDexEnabled true

most of the times. and for more information please tell me the exact thing you didnt undestand

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