Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the project name

Tags:

flutter

Is it possible changing the project name of a Flutter project? With project name I mean the name you provide when creating a flutter project flutter create name.

like image 623
Bram Vanbilsen Avatar asked Oct 11 '17 17:10

Bram Vanbilsen


People also ask

How do I change the name of my project in API?

Go to design center - Click on the API Spec you want to rename. It will open the raml file. In left hand side, under Files - the raml file name gets displayed. Move the cursor over the raml file name.


2 Answers

That depends on what you are trying to achieve. If you want to change the name of the app which is displayed in the mobile phones menu together with the app icon, you have to change the android:label in the android/app/src/main/AndroidManifest.xml (Code Sample 1) and the CFBundleName in the ios/Runner/Info.plist (Code Sample 2).

Last time I did this it took me ages to find out, why the name of the app was not changed in the list of currently running apps on Android. For that you also need to change the title of your MaterialApp (Code Sample 3).

For renaming it everywhere I would suggest to use search and replace in the project. If you do this, you have to choose a name without spaces or special characters. A project name 'new project' in the pubspec.yaml for example will break the build.

Code Sample 1:

<application     android:name="io.flutter.app.FlutterApplication"     android:label="New Name"     android:icon="@mipmap/ic_launcher">   

Code Sample 2:

<key>CFBundleName</key> <string>New Name</string> 

Code Sample 3:

return new MaterialApp(   title: 'New Name'   ...); 
like image 120
Rainer Wittmann Avatar answered Sep 20 '22 08:09

Rainer Wittmann


To add to Rainer's answer, you may also have to change the com.example.myprojectname file under android/app/build.gradle

Also for the com.example.myprojectname, do not use underscores (ie: com.example.my_project_name)

You may also have to find and replace the com.example.myproject name in the files project.pbxproj and MainActivity.java.

like image 25
Lawrence Du Avatar answered Sep 20 '22 08:09

Lawrence Du