I replaced all the images everywhere (by this I mean in drawable folders and all Windows Assets folders and iOS Resources folder), but it still shows me the default Xamarin
For iOS in visual studio...
Step1: Generate all the app icons from https://appicon.co/
Step2: In solution explorer, under iOS project, expand 'Asset Catalogs' and double click on 'Assests'. You can change the existing 'AppIcon' icons or Add a new Asset and attach the icons.
This is how you add a new asset...
Step3: In solution explorer, under iOS project, double click on Info.plist. Go to 'Visual Assets' tab, click on 'App Icons' and change the 'Source' to the asset that you just created.
Done.
Hope this helps someone!
png
's in mipmap folders with your new iconobj
folder from Android project directoryThis problem had me stumped for a while and none of the answers I found contained the solution.
Xamarin Forms/Android puts 2 icons in each mipmap folder (mipmap-mdpi, mipmap-hdpi, mipmap-xhdpi, etc) - icon.png
and launcher-foreground.png
.
Replace both these images in each of the mipmap folders. I kept the same names but it should be possible to use a different name.
I cleaned and re-built the solution a number of times, however, the app was still deploying with the default icons.
It turned out that the original/default icons still existed in the Android project obj
folder, even after cleaning and re-building multiple times.
Delete the obj
folder from the Android project and build the solution. This successfully deployed the app with the new icon.
If you changed the icon name(s) please ensure you update the reference on MainActivity.cs
[Activity(Label = "MyName", Icon = "@mipmap/myicon", Theme = "@style/MainTheme"]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
}
You may also need to update the reference to launcher_foreground
in icon.xml
and icon_round.xml
in the mipmap-anydpi
folder.
For iOS, please see Managing Icons with Asset Catalogs. A summary taken from the linked page is provided below:
For icons, a special
AppIcon
image set can be added to theAssets.xcassets
file in the app's project.To use an Asset Catalog, do the following:
- Double-click the Info.plist file in the Solution Explorer.
- Click on the Visual Assets tab and click on the Use Asset Catalog button under App Icons.
- From the Solution Explorer, expand the Asset Catalog folder.
- Double-click the Media file to open it in the editor.
- Under the Properties Explorer the developer can select the different types and sizes of icons required.
- Click on given icon type and select an image file for the required type/size.
- Click the Open button to include the image in the project and set it in the xcasset.
I had the same problem, but the following helped resolve it:
If you get stuck on any part of this check out this short video from 02:47 onwards https://youtu.be/5g8lWPQZFxs?t=167. It helped me a lot.
If you replace the Icon.png and still nothing changed on the device, than change "Copy to Output Directory" propertiy to "Copy if newer" or "Copy always". That was my solution.
For Android try to set the icon app like this:
[Activity(Icon = "@drawable/icon")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
.....
}
Make sure that you have changed all the icon images on all drawable folders ( drawable, drawable-hdpi, drawable-xhdpi and drawable-xxhdpi ).
For iOS I like set the app icons and splash screen with Asset Catalogs, here you can find a guide to how to use it:
https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/app-icons/
Tested this today and noticed that you only need to change the icon images in all drawable folders,
drawable,
drawable-hdpi,
drawable-xhdpi
drawable-xxhdpi.
Depending on the device it's going to use different images. For me i used "Visual Studio Android Emulator" using:
- 5" KitKat(4,4) XXHDPI Phone (Android 4,4 - API 19)
Did not need to uninstall and reinstall the app in the emulator, it updated on it's own after starting the project with "build" checked in the menu Build/Configuration manager.
On top of that no code changes were made!