React native vector icons not showing after build APK

Viewed 853

Package.json:

"dependencies":{
   "@expo/samples":"2.1.1",
   "@expo/vector-icons":"^10.0.6",
   "axios":"^0.18.0",
   "expo":"^33.0.0",
   "expo-constants":"^5.0.1",
   "expo-font":"^5.0.1",
   "native-base":"^2.7.0",
   "react":"16.8.3",
   "react-native":"^0.59.8",
   "react-native-banner-carousel":"^1.0.3",
   "react-native-device-info":"^2.3.2",
   "react-navigation":"^3.0.9",
   "react-redux":"^6.0.1",
   "react-timer-mixin":"^0.13.4",
   "redux":"^4.0.1",
   "redux-thunk":"^2.3.0"
}

App.json

{
   "expo":{
      "name":"BIEK",
      "slug":"biek",
      "privacy":"public",
      "sdkVersion":"34.0.0",
      "android":{
         "package":"pk.edu.biek",
         "versionCode":9,
         "permissions":[
            "READ_PHONE_STATE"
         ],
         "icon":"./assets/images/icon.png"
      },
      "platforms":[
         "android"
      ],
      "version":"1.0.9",
      "orientation":"portrait",
      "icon":"./assets/images/icon.png",
      "updates":{
         "fallbackToCacheTimeout":0
      },
      "assetBundlePatterns":[
         "**/*"
      ],
      "description":""
   }
}

Issue is that when i run the app on expo, it builds successfully and all icons are showing perfectly but when i build apk by expo build:android command and install it on any mobile. Icons are showing like [x].

3 Answers
  • Yes, Rafy First use this command ,react-native link react-native-vector-icons then run your project.

    Thanx.

In my case I solved it by adding a line in android/app/build.gradle

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

after this run link command using your command prompt

react-native link

after this icons are visible both in debug device and also in apk after build. Please let me know if it works or not.

Related