From 1b8f7e7a366cb69155ef930dfb581969a5389ad0 Mon Sep 17 00:00:00 2001 From: Petter Hesselberg Date: Thu, 30 May 2019 11:05:56 -0700 Subject: [PATCH] Don't reference null android.ndkDirectory in build.gradle (#25088) Summary: If you (try to) build React Native for Android without having the NDK properly installed and referenced, you get the following error: >A problem occurred evaluating project ':ReactAndroid'. \> Cannot get property 'absolutePath' on null object This is not an overly helpful diagnostic. This PR results in this message instead: >ndk-build binary cannot be found, check if you've set $ANDROID_NDK environment variable correctly or if ndk.dir is setup in local.properties Fixes #25087 ## Changelog [Android] [Fixed] - Show proper error message instead of throwing a NullReferenceException if Gradle cannot find the NDK Pull Request resolved: https://github.com/facebook/react-native/pull/25088 Differential Revision: D15559271 Pulled By: cpojer fbshipit-source-id: 35c9a9321af4e4a34bf519144ada48884b48352d --- ReactAndroid/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 8ac94f45161..6e44769892c 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -193,7 +193,7 @@ def findNdkBuildFullPath() { def ndkDir = android.hasProperty("plugin") ? android.plugin.ndkFolder : plugins.getPlugin("com.android.library").hasProperty("sdkHandler") ? plugins.getPlugin("com.android.library").sdkHandler.getNdkFolder() : - android.ndkDirectory.absolutePath + android.ndkDirectory ? android.ndkDirectory.absolutePath : null if (ndkDir) { return new File(ndkDir, getNdkBuildName()).getAbsolutePath() }