Android studio 打包时报错如下:
Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
# methods: 66585 > 65536
Message{kind=ERROR, text=Cannot fit requested classes in a single dex file. Try supplying a main-dex list.
# methods: 66585 > 65536, sources=[Unknown source file], tool name=Optional.of(D8)}
解决方法:
在build.gradle下的
defaultConfig下加入
multiDexEnabled true
如:
defaultConfig {applicationId "com.tianxin.mapclient.liteapp"minSdkVersion 15targetSdkVersion 27versionCode 19versionName "19.0"multiDexEnabled truejavaCompileOptions {annotationProcessorOptions { includeCompileClasspath = true }}ndk {abiFilters "armeabi", "x86", "x86_64", "mips64", "mips"}manifestPlaceholders = [JPUSH_PKGNAME : applicationId,JPUSH_APPKEY : "880fe88703ab92260d7d42ca", //JPush上注册的包名对应的appkey.JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.] }