java - “错误:无法在单个 dex 文件中容纳请求的类(# 方法:66653 > 65536)”生成签名的 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 方法限制之下。
推荐阅读
- oracle11g - 根据复选框中选择的内容分配 P1_tem 的值
- python - 为什么我的打印被跳过而我得到一个回溯错误?
- xpages - 如何使用 ssjs 从 Xpages 中清除 sessionScope?
- ios - 从 xib 导航到 tableView 时应用程序崩溃
- c# - 如何加载带有价格标签和底部名称的网格图像
- c++ - 将函数指针从一种类型转换为另一种类型的最佳方法是什么?
- java - 开放差异活动的差异推送通知
- css - @Import scss,相对路径,angular-cli
- parsing - 是否有关于使用边做边学或增量方法编写手写解析器的书籍/文章?
- xamarin - 向开发人员索取 Microsoft.NET.Native.Runtime.2.1 包