android - multidex错误不断崩溃

标签 android gradle

我只是尝试了在stackoverflow上发现的所有内容,但无法解决我的问题,启用了多dexing并禁用了miniyfenabled,但什么都没有发生,这是我的应用程序build.gradle,自3个小时以来,我一直找不到问题并且变得烦人。

android {
    signingConfigs {
    }
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.xxxx.xxxx"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 38
        versionName "4.3.0" //
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        // Enabling multidex support.
        multiDexEnabled true
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
    buildTypes {
        debug {
            applicationIdSuffix '.debug'
        }
        //sourceSets.debug.resources.srcDirs = ['src/debug/res']
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
        }
    }

    //    packagingOptions {
    //        exclude 'META-INF/LICENSE.txt'
    //        exclude 'META-INF/NOTICE.txt'
    //    }
}

repositories {
    mavenCentral()
    maven() { url "https://oss.sonatype.org/content/repositories/snapshots" }
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    jcenter()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'lib')
    compile('com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar') {
        transitive = true
    }
    // Required -- JUnit 4 framework
    compile files('libs/SimpleNLG-4.4.8.jar')
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/mail.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    compile('com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar') {
        transitive = true
    }
    // Optional -- Mockito framework
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.google.android.gms:play-services-analytics:11.8.0'
    implementation 'com.google.android.gms:play-services-location:11.8.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.android.support:customtabs:26.1.0'
    implementation 'junit:junit:4.12'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'io.github.kobakei:ratethisapp:1.2.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.mercadopago:sdk:3.7.2'
    implementation 'com.google.guava:guava:23.3-android'
    androidTestCompile 'com.android.support.test:runner:1.0.1'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation group: 'com.google.apis', name: 'google-api-services-translate', version: 'v2-rev48-1.22.0'
    implementation group: 'com.google.api-client', name: 'google-api-client-gson', version: '1.22.0'

    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'

    // Testing-only dependencies
    androidTestCompile 'com.android.support.test:runner:1.0.1'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile('com.google.code.findbugs:jsr305:2.0.1')
}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

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

还尝试禁用此实现'com.google.android.gms:play-services:11.8.0',也没有执行任何操作。

最佳答案

尝试使用此内部依赖项

 compile ('com.google.dagger:dagger:2.4') {
        exclude group: 'com.google.guava'
    }

关于android - multidex错误不断崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48083336/

相关文章:

javascript - 如何在 html5 网络应用程序中禁用 android 后退按钮单击

android - TCP 客户端/服务器与多播广播

java - Android:Java:不使用 GSON 或 jackson 进行 JSON 解析

java - 找不到 gitlab runner 中下载的文件

Java/Android 数学测试 : Got Curious About Int and Float Math/Conversion/Casting

java - 在 Gradle 日志末尾列出所有构建错误

java - "Gradle Dependencies"无法在 'Apache Tomcat' 运行配置中正确显示

gradle - Gradle上传如何真正起作用?

android - 使用 Android Gradle 插件 3.3.0 合并资源时构建失败

android - 在 ListView 中创建 ListView