When creating a flutter app with Visual Studio Code and trying to upload it to the Google Play Store via the Google Play Store Console, I received the following error:
"The use of "com.example" is subject to restrictions. Please use a different package name"
This error relates to the default name used that includes the example part. There are many guides online on the relevance of the package name, on the naming conventions, and how to update the name in Android Studio.
However, I was completely lost in how to update it in Visual Studio Code. See below which solution finally worked for me.
Not sufficient: Some online guides propose to only change the two occurrences of "com.oldname" (e.g., "com.example") in the build.gradle (which is located in apppath/android/app/)
from
android {
namespace "com.oldname.XXX"
[...]
defaultConfig {
applicationId "com.oldname.XXX"
to
android {
namespace "com.newname.XXX"
[...]
defaultConfig {
applicationId "com.newname.XXX"
After running
the new version might actually be accepted by the Play Store. However, there might be issues with actually starting up the app. This is because the package name has not been updated across all occurrences in the code.
Not possible under VS Code: In Visual Studio Code, I was not able to find "refactor" features that are mentioned for Android Studio and seemingly can fully update the package name across the code.
Solution for VS Code: Instead, in Visual Studio Code, you can additionally replace all occurrence by using: edit -> find in files, searching for "com.oldname".
Once "example" has been replaced by "newname" for all of those occurrences, my app both was starting up without error and was accepted by the Play Store.
Hope this helps some people, who are struggling with the same problem in the future :)