react native Configuration with name 'compileClasspath' not found.

Configuration with name 'compileClasspath' not found.

打包的时候出现这个问题。

再根目录的build.gradle中加入

configurations {

    compileClasspath

}

位置在allprojects标签下面参考下面完整的gradle


buildscript{

    ext{

        buildToolsVersion ='29.0.3'

        minSdkVersion =25

        compileSdkVersion =29

        targetSdkVersion =28

        // supportLibVersion = "28.0.0"

    }

    repositories{

        google()

jcenter()

}

}

def REACT_NATIVE_VERSION =new File(['node','--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects{

    configurations{

        compileClasspath

}

    buildscript{

        repositories{

            google()

jcenter()

}

        dependencies{

            classpath'com.android.tools.build:gradle:4.0.1'

        }

}

    repositories{

        mavenLocal()

maven{

            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm

            url("$rootDir/../node_modules/react-native/android")

}

        maven{

                    // Android JSC is installed from npm

                    url("$rootDir/../node_modules/jsc-android/dist")

}

        google()

jcenter()

maven{ url"https://jitpack.io" }

}

    configurations.all{

        resolutionStrategy{

            // Remove this override in 0.65+, as a proper fix is included in react-native itself.

            force"com.facebook.react:react-native:" + REACT_NATIVE_VERSION

}

}

}

你可能感兴趣的:(react native Configuration with name 'compileClasspath' not found.)