Skip to content

Commit 1b8f7e7

Browse files
Petter Hesselbergkelset
authored andcommitted
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: #25088 Differential Revision: D15559271 Pulled By: cpojer fbshipit-source-id: 35c9a9321af4e4a34bf519144ada48884b48352d
1 parent 46500b3 commit 1b8f7e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ReactAndroid/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def findNdkBuildFullPath() {
193193
def ndkDir = android.hasProperty("plugin") ? android.plugin.ndkFolder :
194194
plugins.getPlugin("com.android.library").hasProperty("sdkHandler") ?
195195
plugins.getPlugin("com.android.library").sdkHandler.getNdkFolder() :
196-
android.ndkDirectory.absolutePath
196+
android.ndkDirectory ? android.ndkDirectory.absolutePath : null
197197
if (ndkDir) {
198198
return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
199199
}

0 commit comments

Comments
 (0)