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

1
  • Try to create the assets folder manually in the directory. and then put your icons there. Commented Mar 27, 2020 at 5:49

5 Answers 5

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!

Sign up to request clarification or add additional context in comments.

Comments

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

3 Comments

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?
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?
If you mean the shape and mask. developer.android.com/google-play/resources/… 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.
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

Comments

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".

Comments

0

To solve this problem I just opened the Android Studio with the terminal /opt/android-studio/bin/studio.sh. So after loading a lot of things, the options appear to me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.