在使用Visual Studio Code创建Ffltter应用程序并try 通过Google Play应用store 控制台将其上传到Google Play应用store 时,我收到以下错误:

"com.Example"的使用受到限制.请使用其他包名

这与使用的默认名称有关,该名称包括示例部件.网上有很多关于包名的相关性、命名约定以及如何在Android Studio中更新包名的指南.

我完全不知道如何在Android Visual Studio代码中更新它……

推荐答案

一些在线指南建议只更改位于apppath/android/app/的build.gradle中出现的两次"com.ample"

从…

android {
namespace "com.example.XXX"
[...]
defaultConfig {
applicationId "com.example.XXX"

android {
namespace "com.newname.XXX"
[...]
defaultConfig {
applicationId "com.newname.XXX"

However: While, after 1) saving, 2) flutter clean, 3) flutter build appbundle, the new version might actually be accepted by the Play S至re, there might be issues with running the app. This is because the package name has not been updated across all occurrences in the code. Under Visual Studio Code, I was not able 至 use "refac至r" features of in Android Studio, that seem 至 be able 至 fully update the package name .

相反,在Visual Studio代码下,您可以使用以下命令替换所有出现的代码:编辑-&>在文件中查找,搜索"com.Example".

Once "example" has been replaced by "newname" for all of those occurrences, my app was able 至 both start correctly and be accepted by the Play S至re.

希望这能帮助一些正在与同样问题作斗争的人:)

Flutter相关问答推荐

ListTile未正确显示在flutter中

错误:找不到字体功能类型.Ffltter Google_Fonts包错误

在创建肘部并使用冻结时,无法使用中的Copy With方法

为什么Build_Runner的输出为0?

修复后期变量的抖动皮棉

使用GO_ROUTER在模式内导航

如何管理枚举类型的阻塞事件?

SingleChildScrollView在ErrorWidget.builder中不工作

Riverpod Provider.family 和 HookConsumerWidget 不刷新 UI

如何在flutter中更改showModalBottomSheet小部件中CheckboxListTile小部件的值?

NotifierProvider 每次更新都会重新构建并且值不更新

Flutter:注册 UI 出现 UI 问题(将注册框提升到顶部并向电话号码 pin 码添加一个框)

无状态和有状态小部件,我可以同时使用吗?

如何让小部件根据小部件的大小构建不同的布局?

graphql_flutter 错误:非抽象类GraphQLWebSocketChannel缺少实现

Android Electric eel Mac M1:运行 flutter doctor -v 时无法找到Bundle 的 java 版本

如何将 void 函数放入单独的 dart 文件的单独页面中

如何获取 android 和 Ios (flutter) 的 CircularProgress 指示器?

我一直在try 创建按钮以导航到第二页,但不知何故 RaisedButton 功能无法正常工作

Firebase Firestore 查询