1

I have a png file named triedsohardicon.png I want to use for my app's launcher icon, but after putting it in the folder associated with the project, I find that Image Asset Studio doesn't show any triedsohardicon.png in its file system browser in that location.

In addition, if I put the line android:icon="@drawable/triedsohardicon" in AndroidManifest.xml (because I did in fact put the png file in the TriedSoHard/app/src/main/res/drawable folder), the text in quotes just returns the error "Cannot resolve symbol '@drawable/triedsohardicon'".

The png has dimensions 512x512. I could use some help, please.

Soundsgoood
  • 315
  • 3
  • 8

1 Answers1

3

Launcher Icon should be placed in mipmap res\mipmap\triedsohardicon.png

Place your launcher Icon through Image Asset like below:

enter image description here

Upload and Save the png and it will be placed in mipmap automatically.

In Maifest:

android:icon="@mipmap/triedsohardicon"

Hope this helps.

tahsinRupam
  • 6,325
  • 1
  • 18
  • 34
  • Hello there! I don't seem to have a mipmap folder in res, but quite a few folders named mipmap-hdpi, mipmap-mdpi, and the like. Should I create a new folder named mipmap? If not, which one should I put the png file in? – Soundsgoood Mar 16 '17 at 19:44
  • Put it through Image asset or put different sizes in every mipmap-dpi folder accordingly. For this moment you can add in any mipmap folder and it will work. – tahsinRupam Mar 16 '17 at 19:49
  • The image asset browser doesn't find anything but ic_launcher.png in mipmap-hdpi, where I put triedsohardicon.png. I tried synchronizing the project but that doesn't change anything. – Soundsgoood Mar 16 '17 at 20:00
  • Did you add android:icon="@mipmap/triedsohardicon" in your manifest under application tag ? – tahsinRupam Mar 16 '17 at 21:02
  • I hadn't before, but I just changed AndroidManifest.xml to have: android:icon="@mipmap/triedsohardicon" and it still doesn't show up in the Image Asset browser. – Soundsgoood Mar 16 '17 at 21:23
  • Why you have to go to image asset ? If you run your app now you will see your icon has been changed. – tahsinRupam Mar 16 '17 at 21:25
  • I meant I didn't have android:icon="@mipmap/triedsohardicon" in when I tried putting the png file in a mipmap folder. Before this, I had android:icon="@mipmap/triedsohardicon" at one point, which gave me the error mentioned in my original post. It still gives me this error. EDIT: Oof, sorry to be confusing. Before I had android:icon="@drawable/triedsohardicon", now I have android:icon="@mipmap/triedsohardicon". Same error. Thought I should clarify. – Soundsgoood Mar 16 '17 at 21:27
  • You mean, You put triedsohardicon.png in mimmap-hdpi folder, then set android:icon="@mipmap/triedsohardicon". But still showing : Cannot resolve triedsohardicon error ? – tahsinRupam Mar 16 '17 at 21:52
  • That's correct. When I hover over the line in AndroidManifest.xml that's the error it gives. Here's two screenshots, one for this error, one for the Image Asset one: http://imgur.com/a/vI6ey – Soundsgoood Mar 16 '17 at 22:03
  • Thanks for your co-operation. Thats strange. It supposed be a simple task. 1) Try rebuilding\clean\re-open project. If those doesn't work, 2) remove the triedsohardicon from mipmap. Open Image asset upload it from your device location (ex: download) and finish generating icon. 3) Try putting triedsohardicon to all the mipmap folders 4) create a mimmap folder in res then add triedsohardicon.png there. Hope either of this works for you. – tahsinRupam Mar 16 '17 at 22:19
  • 1
    Thanks for the tips. Just for reference, 1) didn't work, but 2) did: Once I uploaded the png file from my Desktop, the Image Asset browser was able to find it and subsequently copy it to all the mipmap folders. Subsequently the error from AndroidManifest.xml became resolved. I didn't try the others. I guess I don't need to move my assets into any Android Studio folders from now on. – Soundsgoood Mar 17 '17 at 02:16
  • Yeah, 2) is very handy. It generates icons for different screen-size automatically. Glad you solved your problem. If the answer helped you can mark it as an accepted answer. – tahsinRupam Mar 17 '17 at 03:58