当我们项目中的方法超过65536个的时候会报以下错误:
Error: Cannot fit requested classes in a single dex file (# methods: 92724 > 65536)
要解决以上问题:
我们只需要在AndroidStudio上的build.gradle(module:app)这个文件上添加一行:multiDexEnabled true。
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
buildToolsVersion PROP_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.riceball.crossyhero.and"
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
...
// Enabling multidex support.
multiDexEnabled true
...
}