Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - The package conflicts with an existing package by the same name

I´ve this default config on Gradle.

defaultConfig {
    applicationId "com.my.application"
    minSdkVersion 16
    targetSdkVersion 22
    versionCode 190011
    versionName "2.2.1"
}

And those flavors

productFlavors {
    dev {
        applicationIdSuffix ".dev"
        versionCode 333333
        buildConfigField "String", "ANVIL_BASE_URL", "DEBUG_URL"
        resValue "string", "app_name", "app name dev"
        signingConfig signingConfigs.releasesign
    }
    prod {
        buildConfigField "String", "ANVIL_BASE_URL", "PROD_URL"
        resValue "string", "app_name", "app name"
        signingConfig signingConfigs.releasesign
    }
}

I´ve got the app released on the Play Store with the default application id "com.my.application" but when I´ve the Play Store version installed and want to install the "dev" flavored application it pop a message that says this:

app name dev 
App not installed
The package conflicts with an existing package by the same name

Am I doing something wrong? I´ve tried changing the buildCode for dev but that didn't work either.

Any guess?

Thanks in advance.

like image 454
axierjhtjz Avatar asked Sep 22 '16 13:09

axierjhtjz


1 Answers

Well, while trying to install a modified version of the app through command line I found the following error:

adb install ~/Desktop/app-dev-release.apk
Failed to install /Users/axier/Desktop/app-dev-release.apk: Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.my.application.dev attempting to redeclare permission com.my.application.permission.C2D_MESSAGE already owned by com.my.application]

So I´ve modified my AndroidManifest.xml file like this:

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />

Pretty poor error description for this one. Hope the solution works for someone like me in the future.

Thanks anyway.

like image 121
axierjhtjz Avatar answered Oct 15 '22 04:10

axierjhtjz