Reputation: 1150
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
Has anyone expirenced this and have a suggestion?
Environment
Icon Screenshot
Upvotes: 1
Views: 3069
Reputation: 41
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
Upvotes: 0
Reputation: 4279
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".
Upvotes: 0
Reputation: 1150
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!
Upvotes: 1
Reputation: 506
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
Upvotes: 0
Reputation: 2057
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
Upvotes: 0