'Ionic 4: You need to use a different package name because "io.ionic.starter" already exists in Google Play
I am trying to deploy my ionic app to Google Play. However, when I upload the app apk file, I get this error message You need to use a different package name because "io.ionic.starter" already exists in Google Play.
According to this thread: Error while uploading apk built on Ionic to the google playstore I need to change my config.xml
file, I only see config file in the path app/res/xml/config.xml
which has this
<?xml version='1.0' encoding='utf-8'?>
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<access origin="*" />
</widget>
How do I solve this issue?
note that I have this in capacitor.config.json
{
"appId": "io.ionic.stackie",
"appName": "Stackie",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "www",
"cordova": {}
}
Solution 1:[1]
If you updated the appId in the capacitor.config.json
file after adding the android project with npx cap add android
, the appId will not copy/update over to your android project.
Take a look at the build.gradle
file in android->app folder and double-check that the applicationId is not "io.ionic.starter"
. The build.gradle
will probably look something like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myexampleapp.unique"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
If you update the applicationId in the build.gradle
file and rebuild the project in Android Studio I think you will be good to go.
Hope this helps.
Solution 2:[2]
I fixed this problem by replacing all occurrences of io.ionic.starter
by io.ionic.stackie
in /android
directory. This might not be the best way to solve this issue but it worked with me.
Solution 3:[3]
I was able to fix this issue the following way (macOS Monterey):
In Android Studio, go to File > Project Structure. There you can change the Application ID.
Of course you need to rebuild your project: Build > Generate Signed Bundle / APK…
If this does not work, read on for all of the steps I did before, even though I think that they could be skipped.
first in Android Studio I replaced all occurrences of "io.ionic.starter" by going to Edit > Find > Replace in Files …
Then in Android Studio I searched for files with 'config' in them and looked for "io.ionic.starter" and replaced it there manually. Even though the first step should have replaced it, it still was there.
As all of this did not help, I got inspired by @x7R5fQ and did a double click on the android folder in the Project tab of Android Studio. Suddenly a Window called 'Project Structure' opened and I was able to change the Application ID there.
Solution 4:[4]
not this config file. there is another config file is located in project root folder.you have to change the id.
<widget id="io.ionic.starter">
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rich Tillis |
Solution 2 | x7R5fQ |
Solution 3 | Kristian Heitkamp |
Solution 4 | shanthan |