Change app bundle name from "com.example" to "com.mycompany" for a windows desktop application

I am building a windows application using dart and I need to change the app bundle name from “com.example” to say “com.mycompany”. I have tried changing the runner.rc in windows folder, it did create that folder but in the runtime it was still accessing “com.example”. I looked in various websites I didn’t really found anything specifically for windows application. If anybody knows how to do it please help me out.

IMO the surest way is to create a new project with flutter create --org com.mycompany, then copy that into your existing project and see what’s changed with git. Go through the changes, revert lines/files that don’t need to be changed. Verify new file additions if there’s a duplicate remove the equivalent older one, copying over stuff from the old one that might be needed, for example this is a good way to change your old .gradle files to .gradle.kts, if it’s an old project. Some time it’s better to just delete everything except lib and copy everything from the new project, depends on how many things you have modified in the platform configs.

This shouldn’t take too much time and if you have git you can’t mess it up. There are tools and guides for changing these names, but I found them incomplete.

Also look at this flutter create | Fig, you can also define some other things with create like project-name, that will be displayed in the OS.

I checked windows folder in git (as this is a windows app), the only thing that changed was where “com.example” was written, it had been changed to “com.mycompany” which I had already tried previously. Furthermore, I tried the other way around, I replaced the auto generated folders like “lib”, “test” and .yaml files to my application’s files, it still behaved the same way. It was able to make “com.mycompany” folder in userappdata but was still accessing “com.example” during runtime.

Did you do ‘flutter clean’ and ‘flutter pub get’ after the changes? If not, I would try that.

Yes I do that every time I build.

Not a very orthodox method, but I did this once using vscode searching for “com.example” and replacing by “com.mycompany” having a look file by file at what I was changing - it worked for me (also building for windows).

you should try making a clean project, delete everything except the lib and git folder

1 Like

Thanks for your help. I was able to achieve that. Apparently I had delete the content of “com.example” and then make the .exe file again from start, basically ‘flutter clean’, ‘flutter pub get’ then make installer.