OrhanC1
OrhanC1

Reputation: 1410

INSTALL_FAILED_ALREADY_EXISTS with two different package names

I have two manifests that I swap round when building different releases of my app. The manifests have different package names yet I can only build one on the device at a time. I really need both to be built. The project has no src files and uses an activity from a library.

Manifest one:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.pkgone" android:versionCode="01" android:versionName="0.1">
  <uses-sdk android:minSdkVersion="8" />
  <application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
    <activity android:label="@string/app_name" android:name="com.test.Splashscreen" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
</manifest>

Manifest Two:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.pkgtwo" android:versionCode="01" android:versionName="0.1">
  <uses-sdk android:minSdkVersion="8" />
  <application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
    <activity android:label="@string/app_name" android:name="com.test.Splashscreen" android:screenOrientation="portrait">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
</manifest>

Upvotes: 0

Views: 462

Answers (2)

Met Kiani
Met Kiani

Reputation: 884

I solved it. I had the same problem. You need to change the "applicationId" in your build.gradle(Module:app) file

be aware that there will be two build.gradle files. Open the one with (Module:app)

then clean your project.

Upvotes: 0

OrhanC1
OrhanC1

Reputation: 1410

I've sorted it out! The issue was that the R.java file in the gen folder wasn't being cleaned so I just ran

ant clean

before

ant release

and it works great! Thanks to @enrmarc and @Roman Nurik for their help :)

Upvotes: 1

Related Questions