【问题标题】:Cannot fit requested classes in a single dex file. Try supplying a main-dex list. # methods: 66029 > 65536无法在单个 dex 文件中容纳请求的类。尝试提供一个 main-dex 列表。 # 方法:66029 > 65536
【发布时间】:2018-08-03 09:53:30
【问题描述】:

我正在尝试从我的应用程序build apk 但每次我尝试和build apk 我都会收到以下错误。

Cannot fit requested classes in a single dex file. Try supplying a main-dex list. methods: 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'
}

【问题讨论】:

标签: android android-build


【解决方案1】:

在您的 build.gradle 中启用 multidex。

defaultConfig {
    ...
    multiDexEnabled true
}

【讨论】:

    猜你喜欢
    • 2020-02-03
    • 2018-06-23
    • 2018-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多