Ionic 4:您需要使用不同的包名称,因为 Google Play 中已存在“io.ionic.starter”

AZ *_* SH 1 android android-studio ionic-framework ionic4

我正在尝试将我的离子应用程序部署到 Google Play。但是,当我上传应用程序 apk 文件时,我收到此错误消息You need to use a different package name because "io.ionic.starter" already exists in Google Play.根据此线程:将基于 Ionic 构建的 apk 上传到 google playstore 时出错我需要更改我的文件,我只在具有此内容的config.xml路径中看到配置文件app/res/xml/config.xml

<?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>
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?请注意,我有这个capacitor.config.json

{
  "appId": "io.ionic.stackie",
  "appName": "Stackie",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "www",
  "cordova": {}
}
Run Code Online (Sandbox Code Playgroud)

Ric*_*lis 7

capacitor.config.json如果您在添加 android 项目后更新了文件中的 appId npx cap add android,则 appId 将不会复制/更新到您的 android 项目。

查看build.gradleandroid->app 文件夹中的文件并仔细检查 applicationId 是否不是"io.ionic.starter". 可能build.gradle看起来像这样:

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"
    }

 ...
Run Code Online (Sandbox Code Playgroud)

如果您更新文件中的 applicationIdbuild.gradle并在 Android Studio 中重建项目,我想您就可以开始了。

希望这可以帮助。