2015年8月22日 星期六

Solving the confliction on Android BuildToolsVersion 23 with RenderScript v8 library

If you using renderscript support library, and you try to upgrade the android tools version to 23.0.0. you will get the issue likes when compile your project :

UNEXPECTED TOP-LEVEL EXCEPTION:com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

it cause the renderscirpt support library includes the annotation library's source code. you can solve this issue by adding a few of code in build.gradle

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

reference : http://stackoverflow.com/questions/32051938/getting-multiple-dex-error-when-using-render-script-support-lib/32090710#32090710

沒有留言:

張貼留言