I am working with Xamarin.Forms in Visual Studio For Mac and I have created a very basic Xamarin.Forms application.
I have checked Android and iOS targets. I got 3 projects:
The Android specific application has a ".Droid" suffix in application name.
So I decided to right click on droid project, and to remove this suffix in "Assembly name" field.
I got an exception where I run the app (at startup). If I change Assembly name again to put the droid suffix, it does not work anymore.
You can try this with a blank project with the latest version of Xamarin.Forms.
I do not understand why?
The problem is that you are changing the assembly name of your application, not the name.
If you want to change the application name in Xamarin.Forms Android
you have two options:
MainActivity
and change the Label
property:Label
of the MainActivity
and add the name in the Manifest.xml
via UI or code:
On iOS you must change it in Info.plist
.
Other answer works fine. But I am adding more details .
Application name is picked from AndroidManifest.xml file i.e. <application android:label=@string/app_name
, which in turn refers to values>strings.xml file . Do not hard code app name here. Its good practice separate all strings used in strings.xml
file.
strings.xml
<resources> <string name="app_name">App Name</string> </resources>
Label
property overrides this and sets the app title , apk name to Label value set inside MainActivity
.
Its preferable to delete Label value from MainActivity.cs's assembly directive [Activity
(as it overrides this manifest value at debug time) change the value in strings.xml so that its global and consistent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With