如何修复此错误,它发生在我尝试从 react-native 项目构建 .apk 时

时间:2021-06-06 18:41:57

标签: android react-native

这是我在 ./gradlew assembleDebug 项目的 android 目录中尝试使用 react-native 命令构建 .apk 时遇到的错误,感谢您的任何建议和帮助< /p>

* What went wrong:
A problem occurred evaluating project ':@react-native-community_masked-view'.
> No signature of method: build_9xydcf3yl2vrrdybqldni6i35.android() is applicable for argument types: (build_9xydcf3yl2vrrdybqldni6i35$_run_closure1) values: [build_9xydcf3yl2vrrdybqldni6i35$_run_closure1@161d1d4]

我的 build.gradle 看起来像这样:

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

buildscript {
    ext {
        buildToolsVersion = 30
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")

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

allprojects {
    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://www.jitpack.io' }
    }
}

我不知道出了什么问题,欢迎任何帮助

1 个答案:

答案 0 :(得分:0)

请将 buildToolsVersion 值提供为 string 而不是 ./build.gradle 文件中的 number buildToolsVersion='28.0.0' 代替 buildToolsVersion=28