解决com.android.dex.DexException: Multiple dex files define Lcom/google/gson/JsonSerializer;

我在开发Windows Azure的Mobile Service(隔天补上创建过程)的安卓客户端时,报出了com.android.dex.DexException: Multiple dex files define Lcom/google/gson/JsonSerializer;这个错误,如图

出现类似Mutiple dex files这类错误的一般都是有重复的库添加了进去,反复的找,原来自己手贱把一个jar包先放进了项目的libs里面,然后又在gradle里面写下

compile 'com.google.code.gson:gson:2.3'

添加重复啦~不过,在debug的过程中看见一个stackoverflow上面有个挺好玩的相关问题,也贴在这里:http://stackoverflow.com/questions/22468700/unexpected-top-level-exception-com-android-dex-dexexception-multiple-dex-files 

这个的整体思路也是包添加重复,只不过更怪异点,明天再写,睡觉去~

原文地址:https://www.cnblogs.com/mengnan/p/4822412.html