Android – multidexkeepfile does not work properly

We encountered a problem when building the multidex app. We kept receiving different java.lang.noclassdeffounderror errors during application startup

We noticed that they are probably related to the multidex problem. Because the classes required to boot the application must exist in the main DEX file, and they are not included in classes.dex. We executed https://developer.android.com/studio/build/multidex.html#keep But the class we specified in multidex-config.txt, Even the classes in multidex - config. Pro are not placed in the main DEX file (classes. DEX)

Do you have any experience using multidexkeepfile or multidexkeepproguard? Does it really work? Are there any tricks to make it work and put the file in classes.dex?

resolvent:

Try to update your gradle plug-in. I've seen that the configuration is completely ignored in 2.2.0. When I update to 2.3.3, it begins to respect the rules I set

Example:

classpath com.android.tools.build:gradle:2.3.3

In my default configuration, I have this setting:

    multiDexEnabled true
    multiDexKeepProguard file('proguard.multidex.config')

In addition, you may have to perform a clean build before reflecting changes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>