android - 无法在单个 dex 文件中容纳请求的类(# 方法:114237 > 65536)
问题描述
我正在尝试将此驱动程序导入我的简单应用程序(目前只是默认文本视图)在 android 3.5 版本中。驱动程序库已安装并想运行模拟器,我遇到了几个 Gradle 问题并且能够修复它们,最后在这里结束。当我进入时,
类路径'com.android.support:multidex:1.0.3'
在 Gradle 中。
虽然构建成功,但当我运行应用程序时,我收到了如下所述的构建错误。
com.android.tools.r8.CompilationFailedException:编译未能完成
com.android.tools.r8.utils.AbortException:错误:null,无法在单个 dex 文件中容纳请求的类(#方法:114237 > 65536)
此外,我不知道放在哪里(如this)
multiDexEnabled true
和(如此),
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/INDEX.LIST'
}
因为我的 build.gradle 如下,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url "http://dl.bintray.com/shimmerengineering/Shimmer"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
apply plugin: 'eclipse'
classpath 'com.android.support:multidex:1.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "http://dl.bintray.com/shimmerengineering/Shimmer"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
关于如何解决这个问题的任何建议?
~谢谢~
固定如下:
创建了一个新的测试应用程序并找到了 build.gradle 文件并包含在内
allprojects { repositories { jcenter() maven { url "dl.bintray.com/shimmerengineering/Shimmer" } } }
解决方案
尝试在应用程序级别的 gradle 中将最大臀部大小设置为 4 GB
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"//this line
}
推荐阅读
- python - discord bot python删除通道出错
- html - 无法居中引导列表组容器
- flutter - 在 Flutter 中使用 ValueListenableBuilder 切换倒数计时器的可见性?
- javascript - React-native 动画,图像从左到右显示
- apex - Salesforce 测试类获取 System.JSONException:格式错误的 JSON:列表/设置错误开头应为“[”
- javascript - 如何在 JavaScript ES5 中从数组中返回重复的对象计数
- python - AttributeError: 'tuple' 对象没有属性 'items' - Keras,model.fit() 错误
- sql - 如何正确使用JOIN
- woocommerce - 使用“Stripe for Woocommerce”将产品 SKU 添加到 Stripe 订单描述
- c# - C# ParseExact 异常