简体   繁体   中英

Android change app icon

I can't really figure out how to change the app's icon that appears when you install the app, the one on the screen that you have to click.

What i did:

  • I created a new icon --> new > Image asset (mipmap)
  • I deleted ic_launcher (the default one)
  • I named the new asset like the old icon (ic_launcher)
  • Rebuild
  • Clean project
  • Invalidate cache and restart
  • Installed app

nothing. I still have my app with the annoying default mipmap ic_launcher icon.

I don't really know what to do more than this..

Can anyone help me?

EDIT: Sorry, I forgot the manifest.

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true" >
...
...
</application>

As Suke pointed I forgot posting the solution for this question. Sorry all.

After a lot of managements the solution was easy and it was the one google's one.

this link is where you can create all images for android project.

Go there and:

  • insert your image and select all features
  • download it
  • replace all image formats (xxhdpi, hdpi, ...) in your drawable-xxhdpi, drawable xhdpi,... and mipmap-xxhdpi, mipmap-xhdpi,... folders.
  • in manifest set the android:icon = "@drawable/myicon"

this is how I did it

hope it helps

use this side to create icon by uploading the image (use image button)

https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html#foreground.space.trim=1&foreground.space.pad=0&foreColor=607d8b%2C0&crop=0&backgroundShape=square&backColor=ffffff%2C100&effects=none

and then download and save this in drawable folder of your app and then use

 <application
      android:icon="@drawable/myIcon" >
 </application>

in manifests file.

You set your application icon under the <application> tag in your manifest:

<application
    android:icon="@drawable/myIcon" >
</application>

Then just make sure you have a file (such as myIcon.png ) within your resources folder (hdpi, xhdpi, etc)

https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html#foreground.space.trim=1&foreground.space.pad=0&foreColor=607d8b%2C0&crop=0&backgroundShape=square&backColor=ffffff%2C100&effects=none

After generating your icon and downloading the zip file by using the side given above then extract the res folder from zip file and overwrite res folder(by pasting at location eg C:\\MyApplicaton\\app\\src\\main) of your app with this res folder then your code

android:icon="@mipmap/ic_launcher"

will work.
Note: by overwriting res folder it only add or overwrite the mipmap folders and old folder will remain as it was.

OR

you have to replace the ic_launcher icon in all mipmap folder with new ic_launcher according to the icon size with the help of the side given above.

then it will work

folder name like

mipmap-hdpi

mipmap-mdpi

mipmap-xhdpi

mipmap-xxhdpi

Then your code as given below will work

   <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true" >
 ...
 ...
 </application>

In the Manifest add android:icon="@drawable/Icon" in the

<application android:icon="@drawable/Icon" > </application>

make sure that the icon is present in the folder

If you did not uninstall the App with the old icon and upgraded over it, there is a chance it may display the old icon due to cache. Force stopping the App may help.

first paste icon.png file in drawable folder and modify your code as below

    <application
          android:allowBackup="true"
          android:icon="@mipmap/icon"
          android:label="@string/app_name"
          android:supportsRtl="true" >

    </application>

还要确保使用新值更新android:roundIcon="@mipmap/ic_launcher_round" ,这对于较新版本的android有效。

If you still see default android icon, it's simple to fix it... You can use this tools to generate an all-sizes icon. https://appicon.co/ Unzip the mipmap resized file in app res folder. Then in /mipmap-anydpi-v26/ folder, delete both XML files.

Now in the manifest, in the <application> tag, set your icon for both android:icon & android:roundIcon .

As others have pointed out, I created an icon with this link . In my case, I had to adjust both the following parameters to the icon name I added in res.

<application
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher">
</application>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM