简体   繁体   中英

react-native-vector-icons Android

I sucessfully imported icons into iOS and Android by the following:

npm i --save react-native-vector-icons

react-native link

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

However, after closing my Android emulator and returning to the project I am no longer able to view these icons. I've tried rm -rf node_modules && npm i as well as going through the above process but can no longer view these icons on Android (iOS is unaffected and working). I am also starting the emulator before using react-native run-android . I've even tried to run the Android emulator after removing the vector icons and I can't get anything to run on Android.

My current error reads: "A problem occurred configuring project ':react-native-vector-icons'."

What am I missing? Why would it work and then after closing and reopening the project, no longer work? 在此处输入图片说明

Part of my build.gradle file:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.rncardreplacement"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

Pretty sure the issue was that you had gradle 2.2 installed and the project was setup to 1.1.3 like you get in the errors.

For example this is the gradle file of one of my modules:

dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3'
    }

But this is another module:

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM