一、找坑:谷歌规定单个dex文件中的方法不能超过65536的限制
我们编写项目过程中在工程的lib文件夹下引用的第三方插件jar包太多或者项目过大,编译运行时就有可能报出com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536错误。看到这个错误说明你的方法加起来已经超过了65536这个数目。但是谷歌规定单个dex文件中的方法不能超过65536的限制。
如下图所示,Android Studio 中的Message显示了错误
这里是具体的错误代码:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
遇到这个坑的时候找了半天的jar包重复,也是一时糊涂,吸取教训