android - 无法将请求的类放入单个 dex 文件中。尝试提供 main-dex 列表。 # 方法 : 66029 > 65536

标签 android android-build

我正在尝试从我的应用程序构建 apk 但每次我尝试构建 apk 我收到以下错误。

无法将请求的类放入单个 dex 文件中。尝试提供 main-dex 列表。 方法:66029 > 65536

构建

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "28.0.0-rc1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.example.warrenedy.julyfinal"
    minSdkVersion 17
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support.constraint:constraint-layout:1.1.2'
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.apache.poi:poi:3.8'
compile 'com.android.volley:volley:1.0.0'
compile files('libs/jxl.jar')
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.support:support-v4:27.1.1'
testCompile 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

最佳答案

在您的 build.gradle 中启用 multidex。

defaultConfig {
    ...
    multiDexEnabled true
}

关于android - 无法将请求的类放入单个 dex 文件中。尝试提供 main-dex 列表。 # 方法 : 66029 > 65536,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51669996/

相关文章:

android - 任何用于在多个硬件设备上测试 Android 应用程序的服务?

android - 无法构建 Xamarin Android 项目 : An outdated of 'Android SDK Build-tools' is in use

android - 程序类型已经存在 : com. android.internal.http.multipart.ByteArrayPartSource

android - 返回到 MainActivity 的按钮

android - 如何为 manifestPlaceholder 设置默认值

java - 创建 App Engine 后端时找不到 gcm.jar 错误 => 建议安装已弃用的库

android - 如何清理 AOSP 中的模块?

android - 为什么 Android Instant Run 几乎每次都会重新编译?

EditText 的安卓日期键盘类型

android - 从基于 Titan Appcelerator 构建的 Android 应用程序调用电话