358

I am making a React Native app. I would like to customize the app icon (meaning the icon that you click on to start the app). I have Googled this, but I keep finding different types of icons that refer to different things. How do I add these types of icons to the app?

3

17 Answers 17

536

iOS Icons

  • Set AppIcon in Images.xcassets.
  • Add 9 different size icons:
    • 29pt
    • 29pt*2
    • 29pt*3
    • 40pt*2
    • 40pt*3
    • 57pt
    • 57pt*2
    • 60pt*2
    • 60pt*3.

Images.xcassets will look like this:

Android Icons

  • Put ic_launcher.png in folders [ProjectDirectory]/android/app/src/main/res/mipmap-*/.
    • 72*72 ic_launcher.png in mipmap-hdpi.
    • 48*48 ic_launcher.png in mipmap-mdpi.
    • 96*96 ic_launcher.png in mipmap-xhdpi.
    • 144*144 ic_launcher.png in mipmap-xxhdpi.
    • 192*192 ic_launcher.png in mipmap-xxxhdpi.

Update 2019 Android

The latest versions of react native also supports round icon. For this particular case, you have two choices:

A. Add round icons: In each mipmap folder, add additionally to the ic_launcher.png file also a round version called ic_launcher_round.png with the same size.

B. Remove round icons: Inside yourProjectFolder/android/app/src/main/AndroidManifest.xml remove the line android:roundIcon="@mipmap/ic_launcher_round"and save it.

Otherwhise the build throws an error.

12
  • 2
    @adam-katz, this really should be the accepted answer. Commented Mar 4, 2016 at 2:30
  • 3
    Exist any way for make for both directly in react-native?
    – jose920405
    Commented Sep 2, 2016 at 16:19
  • 2
    Just to update this great answer. You now also need 83.5pt*2 for the iPadPro on iOS. Commented Oct 10, 2016 at 23:56
  • 4
    I wrote a generator to automatically generate icons for your react native app from a single icon file :) Hope it can help others! (See this answer)
    – Almouro
    Commented Dec 5, 2016 at 19:25
  • 16
    Where is this in the react native documentation?
    – GONeale
    Commented Oct 5, 2017 at 6:24
350

I wrote a generator to automatically generate icons for your react native app from a single icon file. It generates your assets and it also adds them correctly to your ios and android project:

Update (04/09/2019)

We revamped our generator to be up to date with the ecosystem standards. You can now use @bam.tech/react-native-make.

You can install it using: yarn add @bam.tech/react-native-make in the react-native project

To use it react-native set-icon --path <path_to_png> --background <icon_background_color> --platform <android|ios>

And... that's it! Hope it can be useful for others :)

Recommendations:

Here are some improvements over the previous tool: 🥳

  • No Yeoman dependency, it is now a react-native-cli plugin
  • No Image Magick dependency
  • Creates Adaptive icons for Android
  • Adds missing icons sizes for iOS
15
  • 17
    This should be the accepted answer. You save me huge amount of time! As app developers we really don't care how many icons iOS and Android need, for 9 icons and 4 icons all have same content, who cares? For retina or not retina, for big or small screen, who cares? Just give me the exactly clear and same icons, that's it! Thank you and I would like to try your other tools. :)
    – Zhang Buzz
    Commented May 30, 2017 at 1:02
  • 4
    I found the problem: When installing image-magick, make sure to install legacy tools so the convert command will exist.
    – Rick Love
    Commented Jun 1, 2017 at 21:22
  • 2
    @RickLove I also had this issue after installing imagemagick with yarn -g add imagemagick. I then installed it using homebrew instead (brew install imagemagick) which installed everything necessary and worked. Commented Aug 5, 2017 at 1:24
  • 1
    @PolaEdward no need for Ruby :) All the requirements are here: github.com/bamlab/generator-rn-toolbox/blob/master/generators/…
    – Almouro
    Commented Jan 3, 2018 at 17:33
  • 1
    it helped a lot, but is there anyway to add round icons too? these library just adds normal icons for android. thank you again Commented Mar 28, 2019 at 15:23
35

I would use a service to scale the icon correctly. http://makeappicon.com/ seems good. Use a image on the larger size as scaling up a smaller image can lead to the larger icons being pixelated. That site will give you sizes for both iOS and Android.

From there its just a matter of setting the icon like you would a regular native app.

https://help.apple.com/xcode/mac/8.0/#/dev10510b1f7

Set icon for Android application

3
  • 1
    Apple link is broken, @rmevans9. :( Commented Oct 11, 2016 at 21:47
  • 3
    Note this service collects information about you - such as app name, market category of the app, etc - and prevents image download unless an email address is provided. Commented Sep 23, 2019 at 17:05
  • I have read this answer, and only after some time read Almouro's answer below. I wish I started with Almouro's answer.
    – Yossi
    Commented May 23, 2020 at 20:24
28

I was able to add an app icon to my react-native android project by following this guy's advice and using Android Asset Studio

Here it is, transcribed in case the link goes dead:

How to upload an Application Icon in React-Native Android

1) Upload your image to Android Asset Studio. Pick whatever effects you’d like to apply. The tool generates a zip file for you. Click Download .Zip.

2) Unzip the file on your machine. Then drag over the images you want to your /android/app/src/main/res/ folder. Make sure to put each image in the right subfolder mipmap-{hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi}.

android/app/src/main/res

3) Do not (as I originally did) naively drag and drop the whole folder over your res folder. As you may be removing your /res/values/{strings,styles}.xml files altogether.

0
14

Android Studio has a very handy icon asset wizard called Image Asset Studio (user guide here). It's quite self explainatory, and has a few handy effects and it's built right in:

enter image description here

Screenshot from Android Studio 4.1.3 on Windows 10 enter image description here

7
  • 1
    Do you build your rect-native projects in Android Studio?
    – Adam Katz
    Commented Dec 12, 2016 at 7:52
  • 1
    No, but i regularly have to open it for some reason or another. Same with XCode - eventually you need to cross over to the other side. This is the method I use to generate high quality icon sets in seconds, very suprised it has had such a strong response. Hell - I even own my own open source project to generate icons for mobile apps and I still prefer this method. npmjs.com/package/cordova-media-generator
    – Ryan Knell
    Commented Dec 16, 2016 at 11:42
  • This was awesome - it also prettified the icons, which I found super helpful (like this answer!).
    – Bilal Akil
    Commented Feb 14, 2018 at 6:14
  • Brilliant! Nice one! Commented Dec 6, 2019 at 16:43
  • I've Android Studio 4.1 on MacOS, and I don't see the option to open Image Assets with right click over that folder, neither over others. Commented Nov 4, 2020 at 19:28
13

Someone made a very easy to use tool just for this task: https://www.npmjs.com/package/app-icon

This simple tool allows you to create a single icon in your react-native project, then create icons of all required sizes from it. It currently works for iOS and Android.

I've used it. Made a 512x512 png and then ran that tool and boom, done. Super easy.

2
  • 2
    PS: react-native-icon is marked as deprecated and has been renamed to app-icon; npmjs.com/package/app-icon
    – Eirik H
    Commented Nov 6, 2018 at 8:14
  • 1
    I get trouble to install react-native-make which is mentioned in Almouro's answer. Then I find this app-icon can be installed correctly and it's simple and works well.
    – Chenhua
    Commented Aug 13, 2020 at 4:16
9

Update 2022

Since the Almouro's Answer is no longer maintained

Android and iOS icon

You can now generate icons with one command both for iOS and Android with rounded icon:

npx icon-set-creator create ./path/to/icon.png

I highly recommend using an icon with a size of at least 1024x1024 pixels

Adaptive Android icon

npx icon-set-creator create -b <background> -f <foreground> -A

background - The color (E.g. "#ffffff") or image asset (E.g. "assets/images/christmas-background.png")

foreground - The image asset (E.g. "assets/images/christmas-foreground.png")

2
  • Thank you, I get " ERROR No image path was specified for android" for the adaptive android icon, do you have any idea why ?
    – Tahola
    Commented Jun 9, 2023 at 11:18
  • Didn't work for me, after the command the app still uses old icon.
    – user31782
    Commented Feb 12 at 14:53
8

You'll need different sized icons for iOS and Android, like Rockvic said. In addition, I recommend this site for generating different sized icons if anybody is interested. You don't need to download anything and it works perfectly.

https://resizeappicon.com/

Hope it helps.

8

This is helpful for people struggling to find better site to generate icons and splashscreen

7

Steps Android App icons: Go to this website https://appicon.co/

  1. Add image their and generate icons, it should be downloaded

  2. Unzip the folder

  3. Inside their copy all the folders in AppIcons/android/ (i.e. Folder names: mipmap-xxxhdpi,mipmap-xxhdpi,mipmap-xhdpi,mipmap-hdpi,mipmap-mdpi)

  4. paste above copied folders into {rootFolder}/android/app/src/main/res/ and replace existing ones

  5. Remove this line from AndroidManifest.xml
    (android:roundIcon="@mipmap/ic_launcher_round")

Icons are successfully added

Change IOS App icons: Go to this website https://appicon.co/

  1. Add image their and generate icons, it should be downloaded

  2. Unzip the folder

  3. Inside their copy all the folders in AppIcons/Assets.xcassets/ (i.e. AppIcon.appiconset folder)

  4. paste the AppIcon.appiconset folder into {rootFolder}/ios/{projectname}/Images.xcassets/ and replace existing one

Icons are successfully added

2

If you're using expo just place an 1024 x 1024 png file in your project and add an icon property to your app.json i.e. "icon": "./src/assets/icon.png"

https://docs.expo.io/versions/latest/guides/app-icons

2

For setting the App launch icon for Android Devices in a React-Native project:

  • Take a high resolution image of your logo and place it inside your project directory. Preferably in [Project-DIR]/android/app/src/main/res/
  • Open Android Studio and run your React-native project.
  • In Android Studio's Project window, select the Android view
  • Right-click the res folder and select New > Image Asset
  • A "Configure Image Asset" window will open; Locate your high resolution image and place set it as your "Foreground layer".
  • Set your "Background Layer" if applicable
  • Click "Next" and continue to finish.
  • Run your application again to see the new app launch icon.

Official documentation can be found here: https://developer.android.com/studio/write/image-asset-studio

1

Use this library to make your work easier. It will automate your Icon generation process

https://www.npmjs.com/package/@bam.tech/react-native-make

-1

I personally use this link to generate my desired icons https://appicon.co/

And for importing inside the application.

For IOS Setup

Click on your project from Xcode ==>

then on the left side you will see your click on that ==>

Now you will see subfile name Images.xcassets click on that ==>

you icons size will be displayed on the right hand window ==>

simply drag and drop the icons which we have generated from https://appicon.co/ ==>

and your IOS ICON SETUP IS DONE.

Moving to Android

We will go to Android ==> app ==> src ==> main ==> res

Here you will various folders named mipmap-hdpi till xxxhdpi ==>

Drag the icons from the specific folder to your project specific folder. Happy coding!

1
  • I don't understand your english Commented Jun 22, 2022 at 19:51
-1

To import icons on React Native if you want the icons without having the pictures, then react-native-vector-icons would be the best one. You can use it if you don't want to download the icons and use it in your project.

-4

I would like to suggest to use react-native-vector-icons to import icons to your project. As you use vector icons, you don't need to worry much on icon scaling side. While using the package you are able to use all popular icon set such as fontawesome, ionicons etc..

Besides these iconsets you can also bring your own icons too to your react-native project by packing your icons as a ttf file and you can import that ttf directly to both android and ios project. You can utilise the same react-native-vector-icons library to manage those icons

Here is a detailed procedure to setup custom icons

https://medium.com/bam-tech/add-custom-icons-to-your-react-native-application-f039c244386c

-10

You can import react-native-elements and use the font-awesome icons to your react native app

Install

npm install --save react-native-elements

then import that where you want to use icons

import { Icon } from 'react-native-elements'

Use it like

render() {
   return(
    <Icon
      reverse
      name='ios-american-football'
      type='ionicon'
      color='#517fa4'
    />
 );
}
4
  • How can we add icons for Android, because we specify the name as ios-american-football ? or we can replace ios by android in this syntax? Commented Mar 10, 2019 at 16:58
  • This doesn't address the original question. Commented Apr 28, 2019 at 16:05
  • The post is about launcher icon and has nothing to do with react-native-elements. The library is just for in-app icons.
    – Celestial
    Commented Oct 3, 2019 at 5:44
  • Question is about app icon - it is icon user can see on the launch screen of the devaice Commented Oct 17, 2022 at 6:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.