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

2

16

This is the error-message I get after that I imported the Facebook SDK (3.15.0) into Android Studio (0.8.2).

Error:Execution failed for task ':app:processDebugResources'. Error: A library uses the same package as this project: com.aaa.bbb.test You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be enforced in 1.0

This is mine build.gradle.

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
    applicationId "com.aaa.bbb.test"
    minSdkVersion 11
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}

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

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19+'
compile project(':facebook')

}

And this is mine Facebook build.gradle.

apply plugin: 'com.android.library'

dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile files('libs/bolts.jar')
}

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
    applicationId "com.aaa.bbb.test"
    minSdkVersion 11
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}

lintOptions {
    abortOnError false
}

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        res.srcDirs = ['res']
    }
}
}

I don't find two of the same packages, or I maybe looking on wrong places. Can someone tell me what it could be? Thank you.

Melanson answered 15/7, 2014 at 20:2 Comment(2)
applicationId is the same for both. looks like you just copy and pasted your gradle over to the facebook one for some unknown reasonSanfo
Thank you, worked now. I did it because in the Facebook SDK build.gradle didnt say "minSdkVersion 11 targetSdkVersion 19" so I pasted them incl the applicationID, but works now, thank you.Melanson
K
21

Have you tried changing/removing duplicated applicationId from the defaultConfig in library's build.gradle? That should resolve your issue.

Kex answered 15/7, 2014 at 20:42 Comment(4)
It happened for me because the applicationId and testApplicationId were the same.Dwayne
For me, I was pulling out some code into its own library module, and forgot that the applicationId is also set in the AndroidManifest of my app module. Renaming the package name in AndroidManifest helped my cause.Palacio
I get this error when I am using library . it says "Error:Library projects cannot set applicationId. applicationId is set to 'com.me.com.example' in default config."Drover
Actually, you should also change the applicationId in <manifest package="your.app.package" in the AndroidManifest.xml fileMart
H
2

Just for visibility:

As Vijay Sharma noted in a comment to the other answer this could also be caused by AndroidManifest.xml where applicationId is also defined.

In this case name the applicationId from the lib to something else than the id from the exe.

Hearttoheart answered 5/9, 2017 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.