我不断获得包含名称的多个库[Android]

时间:2015-09-28 11:23:05

标签: android facebook sdk

我一直在

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')
}

3 个答案:

答案 0 :(得分:1)

您要导入一个库两次

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

所以删除其中一行就可以了。

有关更多信息,请查看以下链接

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

答案 1 :(得分:0)

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

注释掉上述任何一行。

答案 2 :(得分:0)

使用此

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'
}