mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Lorenzo Sciandra
parent
46500b3e36
commit
1b8f7e7a36
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user