【问题标题】:How to resolve this issue in using vector icons?如何在使用矢量图标时解决此问题?
【发布时间】:2018-12-12 18:46:53
【问题描述】:

我在我的 react native 项目中使用了矢量图标,它做得很好,但是在为 android 平台进行构建 (react-native run-android) 的几个小时之前,我收到了这个错误。

添加矢量图标的步骤如下:

npm install react-native-vector-icons –save

反应原生链接

谁能帮忙解决这个问题?

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
   > Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
         https://jcenter.bintray.com/com/android/tools/build/gradle/
     Required by:
         project :react-native-vector-icons

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

【问题讨论】:

  • 请把 react-native-vector-icons 升级到最新版本,因为已经发布了一个版本来解决这个问题(4.6.1 应该可以工作)。
  • react native vector icons的可能重复
  • Android Studio 的事件日志有问题吗?
  • 这是 vs 代码中的问题。

标签: react-native npm


【解决方案1】:

将此添加到 build.gradle 这些问题是因为这些软件包发布了一段时间。 它可以解决图像选择器和矢量图标的问题

subprojects {
    if (project.name.contains('react-native-image-picker') ||
        project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }
        }
    }
}

【讨论】:

    猜你喜欢
    • 2021-09-20
    • 2020-03-12
    • 2020-08-24
    • 1970-01-01
    • 2020-04-13
    • 1970-01-01
    • 2019-12-20
    • 2017-10-12
    • 2021-10-30
    相关资源
    最近更新 更多