xDrago
xDrago

Reputation: 2052

Xamarin Android | Application Icon Error. Cant set one

Im new to Visual Studio 2017 with Xamarin and created a App with a Webview in it. My script works when I test it on my device but I just cant add in Icon to it!

I read a lot about it and spend hours trying! I figured out i had to add the Icon to the assemblyInfo like this [assembly: Application(Icon = "@drawable/icon")] After adding this I always get an Error:

Error: No resource found that matches the given name (at 'icon' with value '@drawable/icon'). Test ...\obj\Debug\android\manifest\AndroidManifest.xml 8

But i put an Image in my drawable folder (icon.png) ! I also cant see the icon on the sidebar in my Project folder in Visual Studio..

Some how I figured out that I can add the icon.png file to obj/Debug/res/drawable after I created the fodler drawable there and it will show the Icon on my Android BUT then my App doesnt work anymore -> Blackscreen and the App crashes.

Why is it so hard to add a god damn Icon? I also cant select any Icon in my Properties Tab like its shown in the Tutorial

https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release/#Specify_the_Application_Icon.

The DropDown "Application Icon" is always empty no matter how I try to add my Icon. Thats how it looks on my screen: Picture of Properties

Please help me!

Upvotes: 2

Views: 1230

Answers (1)

Stefanija
Stefanija

Reputation: 1418

Why don't you just do this on your first activity where MainLuncher is true

 [Activity(Label = "MainActivity", MainLauncher = true, Icon = "@drawable/icon_you_want")]
    public class MainActivity : AppCompatActivity
    {
        //...
    }

And remove that [assembly: Application(Icon = "@drawable/icon")] form AssemblyInfo.cs

The dropdown will still remain empty but you will see the image.

Upvotes: 1

Related Questions