Cannot replace default icon in android studio

两盒软妹~` 提交于 2020-01-14 11:35:55

问题


The image I am trying to replace the default icon with is 512x512px .png. To change the icon I go app/res [new; image asset;...]. It won't let me replace or create new icon set in the @drawable. My most recent thought are that I might not have unlocked some priveges but I am able edit contents of drawable by directly accessing it's location

Any ideas?


回答1:


The new version of android studio put default launcher icon(ic_launcher.png) in mipmap-xxx directories, so just copy and paste your new icon to these directores, and reference it as '@mipmap/you_icon', or in code 'R.mipmap.you_icon'. If you still want to use the keyword 'drawable', then create the drawable folders(drawable-xxx), and put your icon there, and reference it as '@drawable/you_icon', or in code 'R.drawable.you_icon'




回答2:


Place your icon in the drawable folder and then simply open your AndroidManifest.xml file and then set the icon you want like this ...

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



回答3:


As what you wrote

app/res [new; image asset;...]

You mean this one on the image right? What specific error does it shows? just make sure that your icon name is the same in the manifest android:icon="@mipmap/youricon"




回答4:


step 1. copy the icon image from mipmap to drawable folders and build your project.

step 2. Change the following code in AndroidManifest.xml

<application
    android:icon="@drawable/ic_launcher"


来源:https://stackoverflow.com/questions/30563900/cannot-replace-default-icon-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!