使用Firebase时在APK META-INF / NOTICE ERROR中复制的重复文件

时间:2016-09-15 19:36:49

标签: java android firebase

我正在尝试在我的应用程序中集成firebase,我已经包含了依赖项,但是当我尝试同步项目时,我收到了一个错误。下面是我的gradle(模块:应用程序)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "oerrride.we.huzykamz.testingappfirebase"
        minSdkVersion 13
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-crash:9.4.0'
    compile 'com.google.firebase:firebase-auth:9.4.0'

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

这是我的gradle(Project:AppName)

// 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:1.5.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
}

这是我在Android工作室This is the Error shown click here

中的错误图片

2 个答案:

答案 0 :(得分:0)

在gradle中添加以下代码

android {     packagingOptions {         排除'META-INF / NOTICE'     } }

答案 1 :(得分:0)

我删除了依赖编译function check(str) { var myRe = /([^(,\s]*)\(([^)]*)\)/g; var myArray; var result = []; while ((myArray = myRe.exec(str)) !== null) { result.push(`[${myArray[1]}, ${myArray[2]}]`); }; return result; } var check1 = check("operator1(value)"); console.log("check1", check1); var check2 = check("operator1(value), operator2(value)"); console.log("check2", check2); var check3 = check("operator1(value), operator2(value), operator_n(value)"); console.log("check3", check3);,因为它是根据此链接https://firebase.google.com/support/guides/firebase-android升级的,所以它带来了该错误,因为现有依赖项中存在某种冲突