更新时间:2023-09-19 23:36:40
我没有完全实现 MultiDex 支持,所以我的一些类不在正确的 dex 文件中.要修复它,您必须做的不仅仅是在 defaultConfig
块中设置 multiDexEnabled = true
.您还必须:
I was incompletely implementing MultiDex support, so some of my classes weren't in the proper dex file. To fix it, you have to do more than just set multiDexEnabled = true
in your defaultConfig
block. You also have to:
compile 'com.android.support:multidex:1.0.1'
MultiDexApplication
而不仅仅是 Application
.或者,您可以在应用程序的 attachBaseContext()
中调用 MultiDex.install()
.compile 'com.android.support:multidex:1.0.1'
in your dependenciesMultiDexApplication
instead of just Application
. Alternatively, you can call MultiDex.install()
in attachBaseContext()
of your application.见 https://developer.android.com/tools/building/multidex.html更多详情.