Skip to content

Commit 1439749

Browse files
committed
android_build_files/android_abis.gradle: Verify that System.getenv("ANDROID_NDK_HOME") is not null prior to using it.
This fixes the following cryptic build error if the "ANDROID_NDK_HOME" environment variable is not set: java.lang.NullPointerException: Cannot invoke method contains() on null object
1 parent bb1640c commit 1439749

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

android_build_files/android_abis.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ android {
2424
// Default list of ABIs available in up-to-date NDK.
2525
abiFilters "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
2626

27-
if (System.getenv("ANDROID_NDK_HOME").contains("r16b") ||
28-
System.getenv("ANDROID_NDK_HOME").contains("r11c")) {
27+
if (System.getenv("ANDROID_NDK_HOME") != null && (
28+
System.getenv("ANDROID_NDK_HOME").contains("r16b") ||
29+
System.getenv("ANDROID_NDK_HOME").contains("r11c"))) {
2930
// Deprecated ABIs are added to the list when building using older NDKs only.
3031
// Rather than an exhaustive list, we only support r11c and r16b.
3132
abiFilters.add("armeabi")

0 commit comments

Comments
 (0)