我不断收到多个包名称为 [Android] 的库

I keep getting more than one library with package name [Android]

我不断收到

Error:Execution failed for task ':streamHdtv2:processDebugResources'.
> Error: more than one library with package name 'com.facebook'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0

错误。我检查了我的 build.gradle 好几次,但找不到任何重复的 Facebook 包裹条目。

我的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.flashlight"
        minSdkVersion 15
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':initActivity')
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
    compile project(':facebook')
}

您正在两次导入一个库

 compile 'com.facebook.android:facebook-android-sdk:4.6.0'
 compile project(':facebook')

所以删除其中一行,它就会起作用。

有关更多信息,请查看下方 link

A library uses the same package as this project after importing Facebook SDK

 compile 'com.facebook.android:facebook-android-sdk:4.6.0'
 compile project(':facebook')

注释掉以上任何一行。

使用这个

Error:Execution failed for task ':streamHdtv2:processDebugResources'.
> Error: more than one library with package name 'com.facebook'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
error. I have checked my build.gradle several times but I couldnt find any duplicate entry for package Facebook.

My build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.flashlight"
        minSdkVersion 15
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':initActivity')
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
}