![](/img/trans.png)
[英]Cannot fit requested classes in a single dex file (# methods: 86010 > 65536)
[英]“Error: Cannot fit requested classes in a single dex file (# methods: 66653 > 65536)” when generating a signed apk
我正在嘗試生成一個簽名的 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'
}
}
深度錯誤:
注意:不要使用組合的
play-services
目標。 它引入了數十個庫,使您的應用程序膨脹。 相反,僅指定您的應用使用的特定 Google Play 服務 API。
當您使用com.google.android.gms:play-services:12.0.1
,您會引入每個Google Play 服務庫。 您應該切換到僅使用您實際使用的庫。 這幾乎肯定會使您處於單個 dex 文件的64k 方法限制之下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.