Getting Multiple dex error when using render script support lib

旧街凉风 提交于 2019-11-29 15:34:00
Luboš Staráček

I've had similar issue. Try add to your gradle file

multiDexEnabled true

just to be sure you are not exceeding the 65K methods dex limit imposed by Android (Java finished with non-zero exit value 2 - Android Gradle). If you are using some other android-support libraries like appcompat or design or support-v4/v7... add another line to your gradle file

configurations {
    all*.exclude group: 'com.android.support', module: 'support-annotations'
}

Renderscript library already includes support-annotations library, which then may collide with those other support libraries, I suppose. Anyway, these gradle commands fixed it for me.

Edit: It was supposedly fixed in 23.1.0 revisions of Android support libraries, therefore after updating to 23.1.0 you'd need to remove that all*.exclude command. Otherwise your app would not compile due to missing support-annotations library.

https://code.google.com/p/android/issues/detail?id=181697 is the bug for this, along with a temporary workaround.

  dexOptions {
  preDexLibraries = false
}

In your build.gradle file try adding the following block inside your android block.

Use

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