How can I change the app display name build with Flutter? - android

I have created the app using Flutter create testapp.
Now, I want to change the app name from "testapp" to "My Trips Tracker". How can I do that?
I have tried changing from the AndroidManifest.xml, and it got changed, but is there a way that Flutter provides to do that?

Android
Open AndroidManifest.xml (located at android/app/src/main)
<application
android:label="App Name" ...> // Your app name here
iOS
Open info.plist (located at ios/Runner)
<key>CFBundleDisplayName</key>
<string>App Name</string> // Your app name here
and/or
Don't forget to stop and run the app again.

UPDATE: From the comments this answer seems to be out of date
The Flutter documentation points out where you can change the display name of your application for both Android and iOS. This may be what you are looking for:
Preparing an Android App for Release
Preparing an iOS App for Release
For Android
It seems you have already found this in the AndroidManifest.xml as the application entry.
Review the default App Manifest file AndroidManifest.xml located in
/android/app/src/main/ and verify the values are correct,
especially:
application: Edit the android:label in the application tag to reflect the final name of the
app.
For iOS
See the Review Xcode project settings section:
Navigate to your target’s settings in Xcode:
In Xcode, open Runner.xcworkspace in your app’s ios folder.
To view your app’s settings, select the Runner project in the Xcode project
navigator. Then, in the main view sidebar, select the Runner target.
Select the General tab. Next, you’ll verify the most important
settings:
Display Name: the name of the app to be displayed on the home screen
and elsewhere.

There is a plugin called flutter_launcher_name.
Write file pubspec.yaml:
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
And run:
flutter pub get
flutter pub run flutter_launcher_name:main
You can get the same result as editing AndroidManifest.xml and Info.plist.

You can change it in iOS without opening Xcode by editing the project/ios/Runner/info.plist <key>CFBundleDisplayName</key> to the String that you want as your name.
FWIW - I was getting frustrated with making changes in Xcode and Flutter, so I started committing all changes before opening Xcode, so I could see where the changes show up in the Flutter project.

Review the default app manifest file, AndroidManifest.xml, located in <app dir>/android/app/src/main
Edit the android:label to your desired display name

There are several possibilities:
1- The use of a package:
I suggest you to use flutter_launcher_name because of the command-line tool which simplifies the task of updating your Flutter app's launcher name.
Usage:
Add your Flutter Launcher name configuration to your pubspec.yaml file:
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
After setting up the configuration, all that is left to do is run the package.
flutter pub get
flutter pub run flutter_launcher_name:main
If you use this package, you don't need modify file AndroidManifest.xml or Info.plist.
2- Edit AndroidManifest.xml for Android and info.plist for iOS
For Android, edit only android:label value in the application tag in file AndroidManifest.xml located in the folder: android/app/src/main
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Your Application Name" //here
android:icon="#mipmap/ic_launcher">
<activity>
<!-- -->
</activity>
</application>
</manifest>
Screenshot:
For iOS, edit only the value inside the String tag in file Info.plist located in the folder ios/Runner .
Code:
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Your Application Name </string> //here
</dict>
</plist>
Screenshot:
Do a flutter clean and restart your application if you have a problem.

A few of the answers here suggest using the package flutter_launcher_name, but this package is no longer being maintained and will result in dependency issues within new Flutter 2.0 projects.
The plugin flutter_app_name (https://pub.dev/packages/flutter_app_name) is a nearly identical package that has sound null safety and will work with Flutter 2.0.
Set your dev dependencies and your app's name
dev_dependencies:
flutter_app_name: ^0.1.1
flutter_app_name:
name: "My Cool App"
Run flutter_app_name in your project's directory
flutter pub get
flutter pub run flutter_app_name
Your launcher will now have the name of "My Cool App".

You can change it in iOS without opening Xcode by editing file *project/ios/Runner/info.plist. Set <key>CFBundleDisplayName</key> to the string that you want as your name.
For Android, change the app name from the Android folder, in the AndroidManifest.xml file, android/app/src/main. Let the android label refer to the name you prefer, for example,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application
android:label="test"
// The rest of the code
</application>
</manifest>

You can change the Application name, by updating the name for both Android and iOS
for Android
just open AndroidManifest.xml file by,
go to inside android>app>src>main>AndroidManifest.xml
like this:-
so my application name is a "demo" so, I will update the label value.
same as for iOS
just open Info.plist file by,
go to inside ios>Runner>Info.plist
like this:-
And change this string value.

One problem is that in iOS Settings (iOS 12.x) if you change the Display Name, it leaves the app name and icon in iOS Settings as the old version.

For Android, change the app name from the Android folder. In the AndroidManifest.xml file, in folder android/app/src/main, let the android label refer to the name you prefer, for example,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application
`android:label="myappname"`
// The rest of the code
</application>
</manifest>

You can easily do this with rename package, It helps you to change your Flutter project's AppName and BundleId for different platforms, currently available for IOS, Android, macOS and Web
To install the package run the following command:
pub global activate rename
To rename the App, use the following command:
pub global run rename --appname "Your App Name"
That's It!
You can check the documentation of the package for full details because it has some nice features to choose the target platform and more.

As of 2019-12-21, you need to change the name [NameOfYourApp] in file pubspec.yaml. Then go to menu Edit → Find → Replace in Path, and replace all occurrences of your previous name.
Also, just for good measure, change the folder names in your android directory, e.g. android/app/src/main/java/com/example/yourappname.
Then in the console, in your app's root directory, run
flutter clean

in case you are releasing for multi-localizations (languages).
for Android:
in your app folder at
[appname]\android\app\src\main\res
add locale folders for example:
values-ar
valuse-en
then inside each folder add a new strings.xml that contains the app name in that language.
for ar
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">ادارة الديون</string>
</resources>
for en
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">debt management</string>
</resources>
The last thing you can do is go to your AndroidManifest.xml file
and set the android:label to the new files you have created.
android:label="#string/app_name"

I saw indeed the manual solution (to go to IOS and Android). But I found out a plugin which enables changing name from one single location:
https://pub.dev/packages/flutter_launcher_name
Just do the following:
Add to pubspec.yaml
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
Run in Terminal:
flutter pub get
flutter pub run flutter_launcher_name:main
Done.

First
Rename your AndroidManifest.xml file
android:label="Your App Name"
Second
Rename Your Application Name in Pubspec.yaml file
name: Your Application Name
Third
Change Your Application logo
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/path/your Application logo.formate"
Fourth
Run
flutter pub pub run flutter_launcher_icons:main

If you like to automate stuff from command line like me, you can use this
appName="TestApp"
declare -a androidAppTypes=(
"main"
"debug"
"profile"
)
# Change app name for Android
for appType in ${androidAppTypes[#]}
do
xmlstarlet ed -L -u '/manifest/application/#android:label' -v "$appName" android/app/src/$appType/AndroidManifest.xml
done
# Change app name for Android
plutil -replace CFBundleDisplayName -string "$appName" ios/Runner/Info.plist

The way of changing the name for iOS and Android is clearly mentioned in the documentation as follows:
Build and release an Android app
Build and release an iOS app
But, the case of iOS after you change the Display Name from Xcode, you are not able to run the application in the Flutter way, like flutter run.
Because the Flutter run expects the app name as Runner. Even if you change the name in Xcode, it doesn't work.
So, I fixed this as follows:
Move to the location on your Flutter project, ios/Runner.xcodeproj/project.pbxproj, and find and replace all instances of your new name with Runner.
Then everything should work in the flutter run way.
But don't forget to change the name display name on your next release time. Otherwise, the App Store rejects your name.

Related

React Native Android app can't find images after application id change

We have a need to change the application id of a react native app, after the apk has been built. I am using "apktool d app.apk" to decode the apk. I then edit app/apktool.yml and change the renameManifestPackage from null to our new application id.
I then rebuild the apk with "apktool b app -o new-app.apk". Next I zipalign and resign the app. After doing this if I install the app on a device, I see that it has the new application id, but the logo on the launch screen does not show up. There are also some BuildConfig variables that are no longer set.
Is there someplace else that react-native uses the application id, that I would have to change it?
You used a wrong way for that!
I've changed project' subfolder name from: android/app/src/main/java/MY/APP/**OLD_ID**/ to: android/app/src/main/java/MY/APP/**NEW_ID**/
Then manually switched the old and new package ids:
android/app/src/main/java/MY/APP/NEW_ID/MainActivity.java:
package MY.APP.NEW_ID;
android/app/src/main/java/MY/APP/NEW_ID/MainApplication.java:
package MY.APP.NEW_ID;
android/app/src/main/AndroidManifest.xml:
package="MY.APP.NEW_ID"
android/app/build.gradle:
applicationId "MY.APP.NEW_ID"
(Optional) android/app/BUCK:
android_build_config(
package="MY.APP.NEW_ID"
)
android_resource(
package="MY.APP.NEW_ID"
)
Gradle' cleaning in the end ( /android folder):
./gradlew clean

Application is not Registered in react native

I have a react native application and I changed the package name of the application using https://www.npmjs.com/package/react-native-rename. After that I tried to run the project but its saying that the application is not registered. I have tried the following steps also.
Opened the project in android studio and make sure that the package name is changed and all the files are also in the same package name.
Tried cleaning the old gradle files.
Uninstalled the previously installed version of the app (The one which have the original package name.
Any help would be appreciated. Thanks in advance
You need to check 2 files to make sure you have equal names there:
index.js -> application name in the last line:
AppRegistry.registerComponent('YourAppName', () => App);
app.json -> name property
In both places names should be equal (case sensitive).
Have you changed the values ​​in the index.ios.js, index.android.js and app.json files?
There are some instructions here.
android\app\src\main\java\com{someFolderName}\MainActivity.java
you landed up on this answer because still you are not able to solve the issue
open the file mentioned in above in title
this used for
Returns the name of the main component registered from JavaScript.
This is used to schedule rendering of the component.
look for method
#Override
protected String getMainComponentName() {
return "AddYourNewNameHere";
}
which might be returning a hard coded string replace it to desired name!!
EXTENDED TIP
ensure you clean your gradle demon as the project does not compile sometimes
for that use following
cd android
gradlew clean

How to get the version of the current installed app using Cordova?

I already found AppAvailability plugin which basically checks if a user installed a certain app on his device.
Is there a possibility to the current version of the app, developer name (important) and everything it possibly can? Is this even possible in general?
Using AppAvailability plugin it is not possible to get the current version of the app.
You would have to use Cordova AppVersion plugin instead.
After install (e.g. cordova plugin add cordova-plugin-app-version), you can this JS code:
cordova.getAppVersion.getVersionNumber().then(function (version) {
$('.version').text(version);
});
Here is the list of methods which you can use to retrieve other details about your application:
getAppName
Returns the name of the app. E.g. "My Awesome App"
getPackageName
Returns the package name of the app - the reversed domain name app identifier like com.example.myawesomeapp.
getVersionCode
Returns the build identifier of the app
getVersionNumber
Returns the version number of the app
Related posts:
How to get the application version and build in an iOS PhoneGap Application?
User versionName value of AndroidManifest.xml in code
Command Line
Also, the version can be found via the command line
$ cordova info
Scroll down until you see Project Setting Files:
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.your.app" version="1.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

Change Spotify apk name

I'm trying to change the name of the apk of spotify, but show me many dependencies to make this...
First I follow this manual: Change Package Names of APKs
On the first step, I found on
in manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.spotify.music" platformBuildVersionCode="24" platformBuildVersionName="7.0">
I modified by com.spotify.jair
On smali I modified the name of the folder smali/com/spotify/music
to Smali/com/spotify/jair
Search Lcom/spotify/music and replace
with Lcom/spotify/jair inside smali folder
After that, when I tried to install and the error:
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.spotify.jair attemptin
g to redeclare permission com.spotify.music.permission.SECURED_BROADCAST already
owned by com.spotify.music]
I modified all the com.spotify.music, inside AndroidManifest.xml to com.spotify.jair and the error is:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /
data/app/com.spotify.jair-1: Can't install because provider name com.spotify.mob
ile.android.mediaapi (in package com.spotify.jair) is already used by com.spotif
y.music]
So inside: res\values\ I found <string name="media_provider_authority">com.spotify.mobile.android.mediaapi</string> I modified: <string name="media_provider_authority">com.spotify.mobile.android.mediaapis</string>
And the error is:
6280 KB/s (35226422 bytes in 5.477s) Success
But the app does not open, and close inspected. Can anybody help me on the debug why the app is closing, Is there are a tool to debug why the app is closing?
Thanks!
Also to add this project tree:
Project Tree
I can't comment, the app is crashing, you need to take a logcat to see why
adb logcat > l0g.txt
Open Spotify
Unplug phone
And then upload that to paste bin

Change default package from com.example for Eclipse Android projects

I am using Eclipse 4.2 with Android SDK.
I am wondering if it is possible to change the default package ID com.example that shows in the "New Android Application" wizard as you type the application name?
I would like it to default to my own package ID so that I don't need to correct the Package Name field each time.
Is this possible to do? Please explain how.
No, you cannot change the default; it's hardcoded in the plugin sources.
(For the curious, it's in com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage#SAMPLE_PACKAGE_PREFIX in the ADT code base). We should consider persisting the most recently set package prefix and inserting the parent package next time. Feel free to file an issue for that at http://b.android.com category Component-Tools.
-- Tor
With Android Studio not running, edit the file: C:\Users\MyAccount\.AndroidStudio\config\options\options.xml (replace C: with the installation drive and MyAccount with your account name).
Within the xml file look for "property name="SAVED_COMPANY_DOMAIN" value=" and change the value to what you want.
Following user2232952's guidance, for new versions of Android Studio change the value of:
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
I'm not sure why so many people have right answers with wrong file location...
I've installed android studio 2020.3 with all default settings and the file others.xml is in folder
C:\Users\MYUSER\AppData\Roaming\Google\AndroidStudio2020.3\options
For anyone coming here in 2020, the file you are looking for is other.xml
It can be found in your AndroidStudio library under config/options/other.xml
(For mac this is probably ~/Library/Application Support/Google/AndroidStudio4.1/options)
Then you can follow the instructions by #Murillo Comino
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
EDIT:
As per #Douglas Kazumi 's comment, it is important that AS will be closed while editing this.
If you've already created your project, you could go to your AndroidManifest.xml file and update the attribute in the Manifest (root) tag
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="1.0" >
Just make sure the rest of your code also reflects this change.
Click the package name and hit Alt+Shift+R and Rename, it will update everything!

Categories

Resources