• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Want to use my own icon for my app

I want to use my own icon for my app. I created icons in various sizes and placed them in the mipmap directories, but android seems to be using xml files (see attached image) in the "drawable" folder to set the icons. Here is my manifest file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="us.mathguy.factornumbers">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

The manifest appears to be instructing android to use the "ic_launcher.png" images that I created and placed in every mipmap directory. However, the apk seems to be built using the xml files in the "drawable" folder. A copy of the Project View for this applicationis attached.

Is there a way to get Android to use my png image for my icon? Thank you!
 

Attachments

  • Project View.PNG
    Project View.PNG
    29.1 KB · Views: 159
You should change this line to your icon name.
Java:
android:icon="@mipmap/ic_launcher_round"  // change to your icon's name

Below line is no needed.You can remove.
Java:
 android:roundIcon="@mipmap/ic_launcher_round"
 
Last edited:
Well, that worked. Two things that I did not realize:

1. The name of my icon image file must not contain upper case letters.

2. Apparently, I cannot replace the file "ic_launcer.png" with my icon image file (which I tried), and leave the reference as is in the manifest file. It appears that Android Studio overwrote my file with its own image, wiping out my file. I needed to copy my file into the mipmap directories and change the reference in the manifest file in the manner you described.

Another note: I did not resize my image file to different sizes for the various mipmap directories. I place the same 512x512 image (fn.png) in every mipmap directory, and the resulting icon looks beautiful on my phone.

The revised manifest file is:

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="us.mathguy.factornumbers">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/fn"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

I am very grateful for your help. I'm glad this has a relatively easy fix. Thank you.
 
Back
Top Bottom