问题
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>
回答1:
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
回答2:
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.
回答3:
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)
回答4:
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 e.g. 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>
回答5:
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
回答6:
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.
回答7:
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>
回答8:
Also make sure to update the android:roundIcon="@mipmap/ic_launcher_round"
with the new value, this is valid for newer versions of android.
回答9:
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
.
回答10:
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>
来源:https://stackoverflow.com/questions/33876329/android-change-app-icon