Android的gradle这个DexException:库DEX文件在多DEX模式下支持

Android的gradle这个DexException:库DEX文件在多DEX模式下支持

问题描述:

我的应用程序最近达到64K限制。
我试图通过添加创建使用--multidex选择多个索引:

My application reached the 64k limit recently. I tried to create multiple dexes using --multidex option by adding :

exec java $javaOpts -jar "$jarpath" --multi-dex "$@"

在DX批处理文件。

在构建过程顺利但在完成运行的应用程序
它给了DexException:库DEX文件在多DEX模式支持

While the build process completed successfully but upon running the application it gave DexException : Library dex files are not supported in multi-dex mode

现在这是什么意思?我搜索谷歌这个,但找不到任何有用的东西。

Now what does this mean ? I searched google for this but could not find anything useful.

- 多DEX 选项 DX 是pre-德兴库项目不兼容。所以,如果您的应用程序使用库项目时,需要禁用pre-德兴才可以使用 - 多DEX

The --multi-dex option to dx is incompatible with pre-dexing library projects. So if your app uses library projects, you need to disable pre-dexing before you can use --multi-dex.

这是说,我不知道为什么这发生在运行时。这显然​​是由 DX 工具暴露构建时失败。也许发生了什么事,你是该应用程序的部分从IDE中运行时,触发生成错误进行了重建。

That said, I have no idea why this occurred to you at runtime. This clearly is a build time failure exposed by the dx tool. Maybe what happened to you is that parts of the app were rebuild when running from the IDE, triggering the build error.