我正在尝试生成签名的 apk,以便可以将我的应用导出到 Google Play 商店。但是我不断收到同样的错误。有什么办法可以解决这个问题吗?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.sean.monacoball"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:12.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services:12.0.1'
}
}
深度错误:
最佳答案
根据 Google Play services setup guide :
Note: Don't use the combined
play-services
target. It brings in dozens of libraries, bloating your application. Instead, specify only the specific Google Play services APIs your app uses.
当您使用 com.google.android.gms:play-services:12.0.1
时,您将引入所有 Google Play 服务库。您应该切换到仅使用您实际使用的库。这几乎肯定会将您置于 64k method limit 之下单个 dex 文件。
关于java - 生成签名的apk时为"Error: Cannot fit requested classes in a single dex file (# methods: 66653 > 65536)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56382775/