1

Problem

I'm trying to add icons to my React Native app for Android but I'm running into a big problem. The recommended way in the Android documentation isn't working for me.

When I right click on the res folder in Android Studio, I don't have the option to create a new "Image Asset" as seen in the "Android Studio Screenshot" below.

What I've Tried

  1. I created a new React Native project on the same version I'm using and still don't have the option to create a new "Image Asset"
  2. I've also tried using an online Android Icon generator and copying each image for each pixel density into the corresponding /res/mipmap folder. The app launches and the image I want shows up as the app Icon, however it isn't formatted properly. In the past I've used Android Studio's Image Asset creator to format the image properly. As you can see from the "Icon Screenshot" below, it's too small and should be taking up the entire icon circle instead of having the white boarder around it.

Has anyone expirenced this and have a suggestion?

Environment

  • React Native 0.61.5
  • Android Studio 3.1.3

Android Studio Screenshot Android Screenshot

Icon Screenshot

enter image description here

bzlight
  • 1,066
  • 4
  • 17
  • 43

4 Answers4

1

I found out why I wasn't able to generate a new Image Asset from Android Studio!

I had to upgrade to the newest version of Android studio from 3.1.3.

I think this was because React Native 0.61.5 is using AndroidX which may not have been compatible with Android Studio 3.1.3 so it wasn't reading my Android project properly.

Once I upgraded Android Studio I was able to use Android Studio's Image Asset generator and properly format the icons!

bzlight
  • 1,066
  • 4
  • 17
  • 43
0

In projectName\android\app\src\main\AndroidManifest.xml setting like this

<application
 ...
      android:icon="@mipmap/picturename"  //(Mine without ".png" is work fine)
 ...
>

And the create file folder like this picture. Here is my project screenshot

高鵬翔
  • 1,997
  • 2
  • 8
  • 21
  • I have the icons named properly in my AndroidManifest. My issue is that they are being displayed but not formatted properly because I can't use the Image Asset creator in Android Studio. Do you have any suggestions for this specific situation? – bzlight Mar 27 '20 at 06:04
  • Maybe you can use adobe XD to export picture. Choosing export android will render all dpi of picture what you needs. Is that what you need? Or you mean the shape of the picture? – 高鵬翔 Mar 27 '20 at 06:14
  • If you mean the shape and mask. https://developer.android.com/google-play/resources/icon-design-specifications To me, I just look for the mask it design, and outside the region set all same color, it should be mask outside automatically on phone. – 高鵬翔 Mar 27 '20 at 06:20
0

Just go through this website to generate android assets and icons for icon AndroidAssetStudio and then just replace your current folder with this and rename icons accordingly

Rishi Sahu
  • 496
  • 3
  • 11
0

In my case, the cause is that Android Studio isn't able to build gradle successfully (the error and solution can be found in this SO post).

Once Android Studio is able to build gradle, I can see "Image Asset".

Fanchen Bao
  • 3,310
  • 1
  • 21
  • 34