配置项目':react-native-image-picker'时出现问题

问题描述 投票:0回答:1
Configure project :react-native-exit-app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

FAILURE: Build failed with an exception.

• 出了什么问题: 配置项目 ':react-native-image-picker' 时出现问题。

Could not resolve all artifacts for configuration ':react-native-image-picker:classpath'.

Could not find any version that matches com.android.tools.build:gradle:2.2.+.

Versions that do not match:
2.3.0
2.1.3
2.1.2
2.1.0
2.0.0
+ 71 more
Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
Required by: project :react-native-image-picker

* 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

我希望如果有人面临与我相同的情况

android reactjs react-native mobile react-native-image-picker
1个回答
0
投票

您要安装什么版本的react-native-image-picker?

我的猜测是,您正在尝试运行旧的 React Native 项目或旧版本的库,或两者都运行(因为“编译”替换警告)。

在这种情况下,我认为您在 Android 上下载这些构建工具时可能会遇到问题,因为 jcenter 存储库自 2022 年以来已被弃用和关闭。

如果您不想更新项目和库(我推荐这样做,因为修复此问题后您可能会遇到类似的问题),请尝试将其添加到 android 目录中的根 gradle 文件中(而不是应用程序中) /gradle)在子项目子句中:

subprojects {
    if (project.name.contains('react-native-image-picker') || 
        project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                mavenCentral()
            }
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.