Android app icon not changing

JassimRahmaJassimRahma USMember ✭✭✭✭
edited April 29 in Xamarin.Forms
Hi,

I have uploaded this app on Play Store:

https://play.google.com/store/apps/details?id=com.softnames.samana

I changed the icon everywhere to my icon but I keep getting the Xamarin default icon when installing the app although I don’t have the Xamarin icon anywhere in my project.

I deleted obj and biin, cleaned the project and restarted several times but still having same problem.

and this is my MainActivity just in case:

[Activity(Label = "Samana", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

and here is the AndroidManifest.xml

<application android:label="Samana" android:icon="@mipmap/icon">;
<receiver android:name="com.onesignal.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.softnames.samana" />
</intent-filter>
</receiver>
</application>



Can any one help please


Thanks,
Jassim
Tagged:

Best Answer

Answers

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    This is the file:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="12" android:versionName="1.0" package="com.softnames.samana" android:installLocation="auto">
        <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-feature android:name="android.hardware.location" android:required="false" />
        <uses-feature android:name="android.hardware.location.gps" android:required="false" />
        <uses-feature android:name="android.hardware.location.network" android:required="false" />
        <permission android:name="com.softnames.samana.permission.C2D_MESSAGE" android:protectionLevel="signature" />
        <uses-permission android:name="com.softnames.samana.permission.C2D_MESSAGE" />
      <application android:label="Samana" android:icon="@mipmap/icon">
          <receiver android:name="com.onesignal.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
              <intent-filter>
                  <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                  <category android:name="com.softnames.samana" />
              </intent-filter>
          </receiver>
      </application>
    </manifest>
    
  • jezhjezh Member, Xamarin Team Xamurai

    Then you can try to set up the Attributes I mentioned above.

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    How about this:

    <application android:label="Samana" android:icon="@mipmap/icon">

    because the icon.png is in the mipmap not in the drawable..

  • jezhjezh Member, Xamarin Team Xamurai

    Yes,you can try this.

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    it did not work so I had to copy my icons again in the drawable folder! then what's the use of the mipmap folders?!

  • jezhjezh Member, Xamarin Team Xamurai
    edited April 30

    I am sorry ,it's my fault , I have ignored the code of MainActivity.

     Icon = "@mipmap/icon"
    

    If we have an icon activity definition in MainActivity and then try to change icon from manifest file, icon would not change because icon activity definition in Main Activity overrides the manifest.

    Why MainActivity overrides the manifest?
    If you click here, document states that if you use [Activity] custom attribute, it causes xml fragment to be added to AndroidManifest.xml at compile time.
    Click here to see that how the [Activity] attribute helps to produce icon in xml fragment. For example:

     [Activity (Label="My App", MainLauncher=true, Icon="@drawable/myicon")] 
    public class MyActivity : Activity 
    {
     }
    

    This example produces the following xml fragment:

     <activity android:icon="@drawable/myicon" android:label="My App" 
         android:name="md5a7a3c803e481ad8926683588c7e9031b.MainActivity">
       <intent-filter>
           <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    

    And I have created a new app and put my icon(testicon.png) in folder drawable, just use the following code, it just works properly.
    For example:

      [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true, Icon = 
     "@drawable/testicon")]
    
  • JassimRahmaJassimRahma USMember ✭✭✭✭

    does this mean the mipmap folders are useless to use for the app icon if I understood you?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Mipmap resources are fine, you just have to make sure you are using them EVERYWHERE you might possibly be specifying the app icon.

    • In the AndroidManifest.xml file
    • In the Application attribute placed on a subclass of Android.App.Application
    • In the Activity attribute placed on an Activity
  • JassimRahmaJassimRahma USMember ✭✭✭✭

    @JoeManke said:
    Mipmap resources are fine, you just have to make sure you are using them EVERYWHERE you might possibly be specifying the app icon.

    • In the AndroidManifest.xml file
    • In the Application attribute placed on a subclass of Android.App.Application
    • In the Activity attribute placed on an Activity

    I never specified the icon in any of these places

  • JoeMankeJoeManke USMember ✭✭✭✭✭
    edited April 30

    @JassimRahma said:

    @JoeManke said:
    Mipmap resources are fine, you just have to make sure you are using them EVERYWHERE you might possibly be specifying the app icon.

    • In the AndroidManifest.xml file
    • In the Application attribute placed on a subclass of Android.App.Application
    • In the Activity attribute placed on an Activity

    I never specified the icon in any of these places

    Lies. You specified it your MainActivity:

    @JassimRahma said:
    and this is my MainActivity just in case:

    [Activity(Label = "Samana", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

    AND your AndroidManifest:

    @JassimRahma said:
    This is the file:

    <application android:label="Samana" android:icon="@mipmap/icon">

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    :) hahaha I mean I did not specify anything other than mipmap that's why I didn't know why it was not showing the icon but now it's showing when I moved it to the drawable folder

Sign In or Register to comment.