[英]react-native-vector-icons Android
I sucessfully imported icons into iOS and Android by the following: 我通过以下方式成功将图标导入了iOS和Android:
npm i --save react-native-vector-icons
react-native link
add: apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
to build.gradle 添加: apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
到build.gradle
However, after closing my Android emulator and returning to the project I am no longer able to view these icons. 但是,在关闭我的Android仿真器并返回到项目之后,我不再能够查看这些图标。 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). 我已经尝试了rm -rf node_modules && npm i
以及通过了上述过程,但是无法再在Android上查看这些图标(iOS不受影响并且可以使用)。 I am also starting the emulator before using react-native run-android
. 在使用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. 在删除矢量图标后,我什至尝试运行Android模拟器,但无法在Android上运行任何东西。
My current error reads: "A problem occurred configuring project ':react-native-vector-icons'." 我当前的错误为:“配置项目':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: 我的build.gradle文件的一部分:
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. 可以肯定的问题是,您已经安装了gradle 2.2,并且像遇到错误一样将项目设置为1.1.3。
For example this is the gradle file of one of my modules: 例如,这是我的模块之一的gradle文件:
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'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.