Android gradle DexException : Library dex files ar

2019-09-06 16:14发布

问题:

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 "$@"

in dx batch file.

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.

回答1:

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.

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.