&引用;无法合并索引“;更新到Android Studio 3.0时出错?

&引用;无法合并索引“;更新到Android Studio 3.0时出错?,android,Android,此错误在我更新到Android Studio 3.0后出现。我在许多类似的问题上尝试了很多方法,但都不管用 以下是错误: 我意识到,当我删除库'com.google.android.gms:play services maps:11.4.2'时,我的项目构建成功了。但是我的项目中需要这个库,有人知道如何处理这个问题吗 我的完整身材,格雷德尔。 buildscript { repositories { maven { url 'https://maven.fabric

此错误在我更新到Android Studio 3.0后出现。我在许多类似的问题上尝试了很多方法,但都不管用

以下是错误:

我意识到,当我删除库'com.google.android.gms:play services maps:11.4.2'时,我的项目构建成功了。但是我的项目中需要这个库,有人知道如何处理这个问题吗

我的完整身材,格雷德尔。

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    google()
}

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "vn.com.ttsoft.dhd"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 14
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        useLibrary 'org.apache.http.legacy'
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {
            // Disable fabric build ID generation for debug builds
            ext.enableCrashlytics = false
        }
    }
    productFlavors {
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    }

    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 files('libs/android-async-http-1.4.4.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/gson-2.3.1.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile 'com.github.pavlospt:roundedletterview:1.2'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:design:25.4.0'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'com.google.android.gms:play-services-maps:11.4.2'
    compile 'me.tatarka.support:jobscheduler:0.1.1'
    compile 'com.evernote:android-job:1.1.8'
    testCompile 'junit:junit:4.12'
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/mail.jar')
}

您从文件中加载什么版本的播放服务?我想这是一个问题,您试图同时加载整个播放服务和部分
播放服务映射。这也解释了这样一个事实,即当您删除贴图时,一切正常

查看此链接,了解选择性编译play services API,这也将有助于减少方法计数

我正在放置gradle文件,您可以使用它,它可能会对您有所帮助

apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "vn.com.ttsoft.dhd"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            // Disable fabric build ID generation for debug builds
            ext.enableCrashlytics = false
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'

    compile files('libs/android-async-http-1.4.4.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/gson-2.3.1.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true;
    }
    compile 'com.github.pavlospt:roundedletterview:1.2'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support:design:25.3.0'
    compile 'com.android.support:support-v4:25.3.0'
    compile 'me.tatarka.support:jobscheduler:0.1.1'
    compile 'com.evernote:android-job:1.1.8'
    testCompile 'junit:junit:4.12'
    compile files('libs/activation.jar')
    compile files('libs/additionnal.jar')
    compile files('libs/mail.jar')
}
apply plugin: 'io.fabric'
还有另一个gradle项目

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'io.fabric.tools:gradle:1.+'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

我也面临着同样的问题,我认为google play服务依赖项出了问题,因此我通过添加以下所有google play服务依赖项解决了问题:

compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'

升级到AS 3.0/Gradle 3.0.0后,我遇到了类似的“多索引”生成错误问题

我发现无效缓存和重启、清理项目以及启用minify的“解决方案”都是骗人的

我为此挣扎了几个小时,然后发现是什么导致了我的问题

我正在使用这些语句编译
毕加索
GSON
SQLiteAssetHelper

        compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
        compile 'com.google.code.gson:gson:2.8.1'
        compile 'com.squareup.picasso:picasso:2.5.2'
…但我还有SQLiteAssetThelper、GSON和毕加索
.jar
文件,这些文件都是从我的
\libs
文件夹编译的

        compile fileTree(include: ['*.jar'], dir: 'libs')
因此,复制品

是的-很明显,但有时你看不到树木的树木

我希望这对某人有帮助


(最后一点注意:
compile
命令在Gradle 3.0.0中不推荐使用,因此您可能希望将上述命令从
compile
更改为
implementation

更改为使用
android async http
并尝试过
enable DEX
invalidate cache
的用户,
删除.gradle文件
检查重复导入/版本

我在
org.apache
android异步http
包中遇到了一些冲突

更改后,即org.apache.http.Header
cz.msebera.android.httpclient.Header
,我的问题解决了

{       
 useLibrary 'org.apache.http.legacy'  // avoid this
}

dependencies {
    compile files('libs/android-async-http-1.4.4.jar') // only keep this one
}

你启用了multidex吗?我在升级时也有一个错误,但我不确定它到底是什么。“清理并重建项目”帮我解决了这个问题。@war\u Hero是的,我在defaultConfig中有“multiDexEnabled true”。@woodii我也尝试过清理并重建,但仍然出错。你能发布完整的构建吗。gradlewhy-1分?:/问题是OP试图代替我加载.jar库,我并没有点击向下箭头:)无论如何,谢谢你们的信息。这个答案与Android 3.0稳定版本有关,而不是Beta 4。因此,它已从Beta 4问题中删除,并重新用于此问题。当然,也可能有相似但不相同的问题。除非搜索者随后来到这里,否则他们将无法找到可能相关的答案。我最初发布了一个指向这个答案的链接,但被其他人删掉了。