I have an abbreviated name (based on app id?) showing up on launcher. How do I change it?
You must edit the Info.plist and AndroidManifest.xml.
For iOS with the next version of the CLI we will support a full Info.plist file located in app/App_Resources/iOS/Info.plist
in our nativescript marketplace demo. However the one in this app is still copied in platforms
in post prepare hook the value used is in the CFBundleDisplayName
there. You should be able to edit the platforms/ios/<proj-name>/<proj-name>-Info.plist
file and rebuild.
For android currently we do merge an AndroidManifest.xml from app/App_Resources/Android/AndroidManifest.xml
similar to the one here, there I think you can place android:label="My App"
on the application
element and avoid manually editing the files in platforms/...
.
In Android you cannot simply change the value of android:label
to any string because when I tried, it raise error "Manifest merger failed : Attribute application@label value=(Example App Name) from AndroidManifest.xml:25:3-33"..
I end up editing the file in /platforms/android/src/main/res/values/strings.xml
and it's works..
The default Info.plist created for iOS projects include XCode build variables:
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
Since it's not obvious in NativeScript projects where these variables could be set, would it make sense to instead automatically use some value from the app's package.json
at build time when this variable is present?
The name
variable makes the most sense, but it doesn't allow spaces. Maybe dashes and underscores can be auto-converted to spaces? Or maybe the app name can be put in nativescript > name
settings section?
Just a thought to improve the clarity of this process for iOS apps.
While you're thinking about this, also note that name should be localizable, which may add a wrinkle
Hi guys!
I'm facing the same issue with the app name.
Once the app is installed, the app icon name shows the correct name as I set in android:label but when the app is being installed it show the package name instead of the app name..
Any idea around this?
In my case I can't edit the application name even if I edit my AndroidManifest
<application android:name="DifferentName">
what else could I try?
@Devlain
Have a look at this.
Hope it's helpful :)
Hey @Devlain
Depending on the API level you are testing you will need to modify the _strings.xml_ in both values and values-21 folders. If such file does not exist in any of these folders, you will need to create it and add the following:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My Application Name</string>
</resources>
Hi people!
I finally resolved this issue in the next manner.
First of all, I looked for strings.xml in values folder, but there wasn't any strings.xml, so I simply created it just as @NickIliev said.
From there I just needed to add that code to that file in that folder. It wasn't required to do the same in values-21 folders to me to fix the issue.
I hope this could help somebody else =)
Thanks all for your help!
Adding a string.xml file gave me a build error:
Error: Duplicate resources
Even after removing the files I still received the same error. I had to completely remove and re-add the Android platform.
Turns out when you do tns platform add android
a strings.xml
("strings" not "string") file is created:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AppName</string>
<string name="title_activity_kimera">AppName</string>
</resources>
I also received build errors if I didn't include the title_activity_kimera
value.
Hey @Devlain
Nice to know you have resolved your issue!
Just a side note - the folder values-v21 is used for API levels equal and greater than 21 so it will be used if you deploy on device with newer API.
@3rror404 - you are absolutely right - the file name is strings.xml (I have revised the name to avoid confusion of other users)
I would also add in case app name is not changed even after strings.xml is added that you need to:
Don't forget to re-add the android platform or to delete the platforms folder after changing the name.
Most helpful comment
Hey @Devlain
Depending on the API level you are testing you will need to modify the _strings.xml_ in both values and values-21 folders. If such file does not exist in any of these folders, you will need to create it and add the following: