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

标签 android gradle

这是什么主要内容以及如何纠正错误

Cannot fit requested classes in a single dex file. Try supplying a main-dex list.

methods: 87928 > 65536



这是我的礼物

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.apoce.app.admin"
        minSdkVersion 16
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:animated-vector-drawable:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.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.facebook.android:facebook-android-sdk:[4,5)'
    implementation 'com.facebook.android:facebook-login:[4,5)'
    implementation 'com.firebaseui:firebase-ui:4.1.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.36.1'
}
apply plugin: 'com.google.gms.google-services'

最佳答案

我通过将此相关性添加到gradle应用程序

implementation "androidx.multidex:multidex:2.0.1"
中来解决此错误
并将此配置multiDexEnabled true更改为defaultConfig

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

相关文章:

安卓工作室 : Gradle - build fails -- Execution failed for task ':dexDebug'

android - 与传感器监听器关联时,SampleRate.MS16、MS32、MS128 代表什么?

android - 使用 downloadManager 下载到外部存储在 Galaxy S7 上无法正常工作

android - 如何从 Eclipse 在 Samsung Galaxy Tab 上测试 Android 应用程序?

java - Eclipse 的 Gradle 集成不断更改 .classpath 文件

android - 无法解决:com.onesignal:OneSignal:3.4.3

android - 云消息和安卓

android - 从内部存储中删除文件

javascript - 使用 loadUrl() 在 android webview 中加载 JavaScript

java - 如何从源代码获取使用 Gradle 构建的工件版本