如何修复Android中定义的多个dex文件

时间:2018-06-02 08:41:52

标签: android android-studio android-gradle

在我的应用程序中,我想要运行应用程序,当运行应用程序时,请在 logCat 中显示以下错误,而不是运行应用程序。

我的gradle代码:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.thoughtbot:expandablerecyclerview:1.3'
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:support-compat:27.1.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.jakewharton:butterknife:8.5.1'
    compile 'com.wdullaer:materialdatetimepicker:3.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.2.0'
    compile 'com.squareup.retrofit2:converter-gson:2.2.0'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    compile 'com.github.GrenderG:Toasty:1.2.5'
    compile 'org.apache.commons:commons-lang3:3.5'
    compile 'com.wang.avi:library:2.1.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.aurelhubert:ahbottomnavigation:2.0.6'
    compile 'com.devbrackets.android:exomedia:4.0.2'
    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'com.daimajia.easing:library:2.0@aar'
    compile 'com.daimajia.androidanimations:library:2.2@aar'
    compile 'com.github.adroitandroid:ChipCloud:2.2.1'
    compile 'com.github.ganfra:material-spinner:1.1.1'
    compile 'jp.wasabeef:glide-transformations:2.0.2'
    compile 'com.android.support:palette-v7:27.1.1'
    compile 'org.adw.library:discrete-seekbar:1.0.1'
    compile 'com.fmsirvent:parallaxeverywhere:1.0.4'
    compile 'com.tapadoo.android:alerter:2.0.1'
    compile 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
    compile 'com.github.aakira:expandable-layout:1.6.0@aar'
    compile 'com.google.android:flexbox:0.2.5'
    compile 'com.github.fiskurgit:ChipCloud:3.0.5'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'
    compile 'com.android.support:support-compat:27.1.1'
    compile 'com.daimajia.easing:library:2.0@aar'
    compile 'com.daimajia.androidanimations:library:2.3@aar'
    compile 'com.github.santalu:aspect-ratio-imageview:1.0.3'
    compile 'com.google.firebase:firebase-core:16.0.0'
}

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

LogCat错误:

Multiple dex files define Landroid/support/v13/view/inputmethod/InputConnectionCompat$1;

1 个答案:

答案 0 :(得分:0)

在您的gradle文件中Multidex启用true: -

  defaultConfig {
         // Enabling multidex support.
         multiDexEnabled true
     }
dependencies {
compile 'com.android.support:multidex:1.0.3'
}

有关详细信息,请访问: - https://developer.android.com/studio/build/multidex