0
点赞
收藏
分享

微信扫一扫

ReactNative进阶(十三):Could not resolve all dependencies for configuration ‘:app:debugRuntimeClasspath‘

(文章目录)

一、前言

在RN开发过程中,执行react-native run-android命令之后,报如下错信息:

Error:Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'

二、解决措施

在项目的build.gradle 文件buildscriptallprojects节点同时加上 mavenCentral() google() 即可。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral() 
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        mavenCentral() 
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

三、延伸阅读

  • 《ReactNative专栏》
举报

相关推荐

0 条评论