sodcalculator

10 Tech How-To

Android Package Name in Use: Error & Fix

Guide 10-36719 · Updated · Step by step

When you see an “Android package name in use” error, it means the unique application ID you’re trying to use for your app is already registered to another app on the Google Play Store or on your test device. The fix is to change the package name (applicationId) in your project to a new, unique value, then rebuild and reinstall the app.

What Is an Android Package Name?

Every Android app has a package name, formally called the application ID in Gradle, that acts as its unique identifier on the device and in the Play Store. It looks like a reverse domain name, such as com.example.myapp. The system uses this ID to distinguish your app from all others, so no two apps on the same device or store can share it. The package name is declared in the build.gradle file under android.defaultConfig.applicationId, and it’s also visible in the AndroidManifest.xml as the package attribute (though in modern Android Studio, the manifest package is largely ignored in favor of the Gradle value).

This ID is permanent once your app is published — you cannot change it after release without creating a brand-new app listing, which is why choosing a unique name from the start is critical.

Why Does the “In Use” Error Happen?

The error surfaces in two main scenarios:

  • Play Store conflict: Another developer has already published an app with the exact same package name. The Play Store requires every app to have a globally unique ID, so you cannot upload your APK or App Bundle with a duplicate.
  • Local device conflict: You’ve previously installed an app with the same package name on your test device, and the new build with the same ID is blocked because Android considers it the same app. This often happens after uninstalling and reinstalling, or when two projects accidentally share the same ID.

Additionally, if you’re testing with a debug build, the system may use applicationId + ".debug" for the test APK, so a conflict can also occur if that derived ID is taken.

How to Fix It: Step-by-Step

  1. Identify the current package name: Open your project in Android Studio, go to build.gradle (Module: app), and look under android.defaultConfig for applicationId.
  2. Check if it’s already in use: Search the Play Store or use an online package name checker to see if another app uses that ID. If it exists, you must change it.
  3. Change the applicationId: Edit the applicationId value to a new unique name. For example, change com.example.myapp to com.yourname.myapp. Ensure it follows reverse domain notation and uses only letters, numbers, and underscores (each segment must start with a letter).
  4. Update the namespace (if needed): In recent Android Studio versions, the namespace in build.gradle must match your project’s package structure for code references. If you change the applicationId, the namespace can stay the same, but if you also change the namespace, you must move your Java/Kotlin files to the new package directory.
  5. Sync and rebuild: Click “Sync Now” in Gradle, then clean the project (Build > Clean Project) and rebuild. This regenerates the manifest and removes old references.
  6. Uninstall the old app from your device: If the conflict is local, uninstall the existing app, then install the new build.

How to Choose a Unique Package Name

To avoid future conflicts, follow these best practices:

  • Use a domain you own, reversed, e.g., com.yourdomain.appname. If you don’t have a domain, use a unique personal identifier like com.yourname.appname.
  • Avoid generic names like com.test.app or com.example — these are almost certainly taken.
  • Check availability before you start developing by searching the Play Store for the exact ID, or using a package name checker website.
  • Remember that the package name is case-sensitive and must be in lowercase for the applicationId.

Common Mistakes and Misconceptions

A frequent mistake is confusing the applicationId with the namespace or the Java package. The applicationId is what the Play Store and device see; the namespace is used for R class and BuildConfig generation; the Java package is where your source files live. You can have different values for each, but changing the applicationId alone won’t move your code files.

Another misconception is that you can change the package name after publishing. You cannot — the Play Store treats the package name as immutable. If you need to rebrand, you must publish a new app with a new ID and migrate users.

Also, some developers think the error only occurs on the Play Store, but it can happen during local development if you install an APK with a duplicate ID over an existing one, even if the signatures differ. Android will reject the installation with “App not installed” or “Package conflict.”

What If the Error Persists After Changing the ID?

If you’ve changed the applicationId and still see the error, check these:

  • Clean build: Sometimes stale build artifacts keep the old ID. Run Build > Clean Project and then rebuild.
  • Check all modules: If your project has multiple modules (e.g., library modules), ensure none of them have a conflicting applicationId in their own build.gradle.
  • Check the manifest: Some libraries or old manifest files may hardcode a package name. Search for the old ID across the entire project.
  • Device cache: Uninstall the app completely, then clear the device’s package cache (Settings > Apps > show all, find the app, clear data/cache, uninstall).
  • Signing key: If you’re installing over an app signed with a different key, Android will refuse. Uninstall the old app first.

Frequently Asked Questions

Can I change the package name of my app after publishing?

No. Once an app is published on Google Play, its package name (applicationId) is permanent. Changing it would create a new app with no existing installs or reviews. You would need to publish a new app and migrate users, which is why choosing a unique name upfront is essential.

What’s the difference between applicationId and package in Android?

In modern Android development, the package attribute in AndroidManifest.xml is mostly deprecated for identifying the app; the applicationId in build.gradle is the true unique ID. The package attribute now defines the namespace for R class and BuildConfig, but you should set it via the namespace in build.gradle. They can be different, but for simplicity, many developers keep them the same.

How do I check if a package name is already taken?

You can search the exact package name on the Google Play Store website or app — if an app comes up, it’s taken. Alternatively, use a package name checker tool online that queries the Play Store database. For local devices, you can use adb shell pm list packages | grep <your.package.name> to see if it’s installed.

Why does my app install with “App not installed” even after changing the ID?

This usually happens because the old app is still installed on the device with the same ID, or because the new APK is signed with a different key than the existing app. Uninstall the old version completely, then install the new one. Also ensure your build.gradle has the correct applicationId and that you’ve done a clean build.

Can two apps share the same package name on different devices?

Yes, technically two apps can share the same package name on different devices if they are not installed on the same device and not published on the Play Store. However, on the Play Store, the package name must be globally unique. On a single device, Android enforces uniqueness, so you cannot install two apps with the same ID simultaneously.

Is the package name case-sensitive?

Yes, package names are case-sensitive. The convention is to use lowercase letters for all segments, but the Android system treats com.Example.App and com.example.app as different. To avoid confusion and potential conflicts, always use lowercase.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →