RNTester->评估项目时出现问题:ReactAndroid

时间:2019-09-03 23:03:55

标签: react-native android-gradle-plugin build.gradle

我正在尝试使用facebook / react-native教程[https://github.com/facebook/react-native/tree/master/RNTester]安装RNTester,但是当我执行“ ./gradlew:RNTester:android:app:installDebug”时,显示一个错误。 / p>

This is for the Ubuntu 19.04, running Android Studio 3.5 and java openjdk version "1.8.0_222"

** build.gradle File**

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

        // 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()
    }
}

**执行./gradlew时出错:RNTester:android:app:installDebug **

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/home/g/projects/react-native/react-native/ReactAndroid/build.gradle' line: 220

* What went wrong:
A problem occurred evaluating project ':ReactAndroid'.
> extensionSupplier.get()!!.compileSdkVersion must not be null

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':ReactAndroid'.
> compileSdkVersion is not specified.

* 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 5s

1 个答案:

答案 0 :(得分:0)

引用fixing commit from the React Native repo

  

之所以发生这种情况,是因为 buildReactNdkLib 任务已被创建并配置。因此,此PR更改了一些需要延迟配置的任务,并在准备好后从 android 读取值。还要删除ANDROID_NDK变量检查,因为android gradle插件会自动执行此操作。

问题已于昨天在react-native#master上解决。尝试获取最新更改并构建RNTester!