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

时间:2018-08-03 09:53:31

标签: android android-build

我正在尝试从我的应用中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'
}

1 个答案:

答案 0 :(得分:4)

build.gradle中启用multidex。

defaultConfig {
    ...
    multiDexEnabled true
}