更新到9.4.0后出现Android Studio Gradle错误

更新到9.4.0后出现Android Studio Gradle错误,android,firebase,google-api,google-play-services,build.gradle,Android,Firebase,Google Api,Google Play Services,Build.gradle,更新到新的Firebase版本后,我发现以下错误。我一直在四处搜索,显然我必须删除一些jar文件,但我似乎不知道从哪里删除这些导致冲突的文件 错误如下。 Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzml; Error:Uncaught translation error: java.lang.Ille

更新到新的Firebase版本后,我发现以下错误。我一直在四处搜索,显然我必须删除一些jar文件,但我似乎不知道从哪里删除这些导致冲突的文件

错误如下。

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzml;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmm;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmn;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmo;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmp;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmq;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmr;

Error:7 errors; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:dex进程返回代码1

渐变文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions {
    preDexLibraries = false
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    ///firebase////
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-storage:9.4.0'
    compile 'com.google.firebase:firebase-crash:9.4.0'
    compile 'com.google.firebase:firebase-auth:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
    compile 'com.google.firebase:firebase-invites:9.4.0'
    compile 'com.google.android.gms:play-services-appindexing:9.4.0'

    //# Single target that includes all FirebaseUI libraries
    compile 'com.firebaseui:firebase-ui:0.4.0'
    compile 'joda-time:joda-time:2.9.4'

    compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.hdodenhof:circleimageview:2.1.0'

    compile 'org.apache.commons:commons-lang3:3.4'

    //compile 'io.github.rockerhieu:emojicon:1.4.1'

    compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
}
apply plugin: 'com.google.gms.google-services'
这是Gradle项目。

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzml;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmm;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmn;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmo;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmp;

Error:Uncaught translation error: java.lang.IllegalArgumentException: 
already added: Lcom/google/android/gms/internal/zzmq;

Error:Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzmr;

Error:7 errors; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

答案是app.gradle的正确依赖项是:


firebase的所有服务都需要这个依赖项,这个:编译'com.google.android.gms:play services appindexing:9.4.0',我认为只要添加app indexing gms服务,您就需要所有包。试试这些变化,并告诉我,问候

答案是app.gradle的正确依赖项是:


firebase的所有服务都需要这个依赖项,这个:编译'com.google.android.gms:play services appindexing:9.4.0',我认为只要添加app indexing gms服务,您就需要所有包。试试这些变化,并告诉我,问候

看到您有许多依赖项,我认为这可能与问题有关,这意味着您的项目有超过64K个方法。因此,您需要启用
MultiDex
,以获得超过64k的数据

您可以通过将以下内容添加到模块级
build.gradle

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}
然后,创建一个
MultiDexApplication
类,或者从
MutliDexApplication
扩展(如果您已经有一个应用程序类)

不要忘记将其添加到您的
清单中:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

...

看到您有许多依赖项,我认为这可能与问题有关,这意味着您的项目有超过64K个方法。因此,您需要启用
MultiDex
,以获得超过64k的数据

您可以通过将以下内容添加到模块级
build.gradle

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}
然后,创建一个
MultiDexApplication
类,或者从
MutliDexApplication
扩展(如果您已经有一个应用程序类)

不要忘记将其添加到您的
清单中:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

...

向我们展示您的gradle文件,thanks@MerlEscarpenterPérez请查看新编辑。你能给我看project.gradle吗?@MerlíEscarpenterPérez查看新编辑。给我们看你的gradle文件, thanks@MerlíEscarpenterPérez请查看新编辑。你能给我看一下project.gradle吗?@MerlíEscarpenterPérez查看新编辑。添加新编辑并更改为9.61版后,确定。我现在有一个错误。错误:.dex文件中的方法引用数不能超过64K。了解如何解决此问题此问题适用于multidex,但您的依赖项现在已正确:)添加此问题并更改为9.61版后,请确定。我现在有一个错误。错误:.dex文件中的方法引用数不能超过64K。了解如何解决此问题此问题适用于multidex,但您的依赖项现在已正确:)更新grandle和清单后,我的类找不到“import com.example.myapp.R”。如何扩展Multidex应用程序?哪些类扩展了它?尝试
清理
重建
您的项目确定更新grandle和清单后,我的类找不到“import com.example.myapp.R”。如何扩展Multidex应用程序?哪些类扩展了它?尝试
清理
重建
您的项目