微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 错误:无法在单个dex文件中适合请求的类.尝试提供main-dex列表. #methods:72477> 65536

我想添加融合位置服务,但它显示了一些错误.
帮我.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsversion "27.0.1"
    defaultConfig {
        applicationId "com.example.adil.bloodbankapplication"
        minSdkVersion 15
        targetSdkVersion 26
        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 filetree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'junit:junit:4.12'
    compile 'com.android.support:design:26.1.0'
    compile 'com.github.joielechong:countrycodepicker:2.1.5'
    compile 'com.jaredrummler:material-spinner:1.2.4'
    compile 'hanks.xyz:htextview-library:0.1.5'
    compile 'com.firebaseui:firebase-ui-database:1.2.0'
    compile 'com.google.android.gms:play-services:11.8.0'
}


apply plugin: 'com.google.gms.google-services'

解决方法:

他们给你的答案都没有详尽无遗.
问题出在Multidex上.
您必须在app gradle中添加库:

实现’com.android.support:multidex:1.0.3′

之后,添加app gradle的defaultConfig

multiDexEnabled true

您的应用程序必须是Multidex类型..
你必须在清单中写下它:

android:name=".MyApplication"

“MyApplication”必须是Multidex类,或者必须扩展它.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐