Allow libicu.so to be compiled aganist on host

Bug: 160350521
Test: m libjavacore
Change-Id: I5bcf079dc330ad831138e39696da1e6e084bcecd
diff --git a/libicu/ndk_headers/uconfig_local.h b/libicu/ndk_headers/uconfig_local.h
index 2ee4c6e..7793976 100644
--- a/libicu/ndk_headers/uconfig_local.h
+++ b/libicu/ndk_headers/uconfig_local.h
@@ -19,7 +19,10 @@
 #pragma once
 
 // Include API-level tagging facility provided by NDK.
+#include <android/log.h>
+#ifdef __ANDROID__
 #include <android/versioning.h>
+#endif
 
 #define U_DISABLE_RENAMING 1
 #define U_HIDE_DRAFT_API 1
diff --git a/libicu/ndk_headers/unicode/uchar.h b/libicu/ndk_headers/unicode/uchar.h
index 68f9cfb..f0c609d 100644
--- a/libicu/ndk_headers/unicode/uchar.h
+++ b/libicu/ndk_headers/unicode/uchar.h
@@ -2569,7 +2569,7 @@
     U_VO_UPRIGHT,
 } UVerticalOrientation;
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check a binary Unicode property for a code point.
@@ -2601,11 +2601,11 @@
 U_STABLE UBool U_EXPORT2
 u_hasBinaryProperty(UChar32 c, UProperty which) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check if a code point has the Alphabetic Unicode property.
@@ -2622,9 +2622,9 @@
 U_STABLE UBool U_EXPORT2
 u_isUAlphabetic(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check if a code point has the Lowercase Unicode property.
@@ -2641,9 +2641,9 @@
 U_STABLE UBool U_EXPORT2
 u_isULowercase(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check if a code point has the Uppercase Unicode property.
@@ -2660,9 +2660,9 @@
 U_STABLE UBool U_EXPORT2
 u_isUUppercase(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check if a code point has the White_Space Unicode property.
@@ -2685,9 +2685,9 @@
 U_STABLE UBool U_EXPORT2
 u_isUWhiteSpace(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the property value for an enumerated or integer Unicode property for a code point.
@@ -2730,9 +2730,9 @@
 U_STABLE int32_t U_EXPORT2
 u_getIntPropertyValue(UChar32 c, UProperty which) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the minimum value for an enumerated/integer/binary Unicode property.
@@ -2755,9 +2755,9 @@
 U_STABLE int32_t U_EXPORT2
 u_getIntPropertyMinValue(UProperty which) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the maximum value for an enumerated/integer/binary Unicode property.
@@ -2788,11 +2788,11 @@
 U_STABLE int32_t U_EXPORT2
 u_getIntPropertyMaxValue(UProperty which) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the numeric value for a Unicode code point as defined in the
@@ -2819,7 +2819,7 @@
 U_STABLE double U_EXPORT2
 u_getNumericValue(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Special value that is returned by u_getNumericValue when
@@ -2830,7 +2830,7 @@
  */
 #define U_NO_NUMERIC_VALUE ((double)-123456789.)
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point has the general category "Ll"
@@ -2858,9 +2858,9 @@
 U_STABLE UBool U_EXPORT2
 u_islower(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point has the general category "Lu"
@@ -2889,9 +2889,9 @@
 U_STABLE UBool U_EXPORT2
 u_isupper(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a titlecase letter.
@@ -2910,9 +2910,9 @@
 U_STABLE UBool U_EXPORT2
 u_istitle(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a digit character according to Java.
@@ -2935,9 +2935,9 @@
 U_STABLE UBool U_EXPORT2
 u_isdigit(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a letter character.
@@ -2960,9 +2960,9 @@
 U_STABLE UBool U_EXPORT2
 u_isalpha(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is an alphanumeric character
@@ -2985,9 +2985,9 @@
 U_STABLE UBool U_EXPORT2
 u_isalnum(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a hexadecimal digit.
@@ -3012,9 +3012,9 @@
 U_STABLE UBool U_EXPORT2
 u_isxdigit(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a punctuation character.
@@ -3032,9 +3032,9 @@
 U_STABLE UBool U_EXPORT2
 u_ispunct(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a "graphic" character
@@ -3055,9 +3055,9 @@
 U_STABLE UBool U_EXPORT2
 u_isgraph(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a "blank" or "horizontal space",
@@ -3087,9 +3087,9 @@
 U_STABLE UBool U_EXPORT2
 u_isblank(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is "defined",
@@ -3116,9 +3116,9 @@
 U_STABLE UBool U_EXPORT2
 u_isdefined(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character is a space character or not.
@@ -3141,9 +3141,9 @@
 U_STABLE UBool U_EXPORT2
 u_isspace(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determine if the specified code point is a space character according to Java.
@@ -3166,9 +3166,9 @@
 U_STABLE UBool U_EXPORT2
 u_isJavaSpaceChar(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified code point is a whitespace character according to Java/ICU.
@@ -3210,9 +3210,9 @@
 U_STABLE UBool U_EXPORT2
 u_isWhitespace(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a control character
@@ -3238,9 +3238,9 @@
 U_STABLE UBool U_EXPORT2
 u_iscntrl(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is an ISO control code.
@@ -3257,9 +3257,9 @@
 U_STABLE UBool U_EXPORT2
 u_isISOControl(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the specified code point is a printable character.
@@ -3279,9 +3279,9 @@
 U_STABLE UBool U_EXPORT2
 u_isprint(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Non-standard: Determines whether the specified code point is a base character.
@@ -3303,9 +3303,9 @@
 U_STABLE UBool U_EXPORT2
 u_isbase(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the bidirectional category value for the code point,
@@ -3326,9 +3326,9 @@
 U_STABLE UCharDirection U_EXPORT2
 u_charDirection(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines whether the code point has the Bidi_Mirrored property.
@@ -3348,9 +3348,9 @@
 U_STABLE UBool U_EXPORT2
 u_isMirrored(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Maps the specified character to a "mirror-image" character.
@@ -3374,9 +3374,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_charMirror(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Maps the specified character to its paired bracket character.
@@ -3397,9 +3397,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_getBidiPairedBracket(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the general category value for the code point.
@@ -3415,7 +3415,7 @@
 U_STABLE int8_t U_EXPORT2
 u_charType(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get a single-bit bit set for the general category of a character.
@@ -3452,7 +3452,7 @@
 typedef UBool U_CALLCONV
 UCharEnumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type);
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Enumerate efficiently all code points with their Unicode general categories.
@@ -3476,11 +3476,11 @@
 U_STABLE void U_EXPORT2
 u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #if !UCONFIG_NO_NORMALIZATION
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the combining class of the code point as specified in UnicodeData.txt.
@@ -3492,11 +3492,11 @@
 U_STABLE uint8_t U_EXPORT2
 u_getCombiningClass(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #endif
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the decimal digit value of a decimal digit character.
@@ -3524,11 +3524,11 @@
 U_STABLE int32_t U_EXPORT2
 u_charDigitValue(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Retrieve the name of a Unicode character.
@@ -3567,13 +3567,13 @@
            char *buffer, int32_t bufferLength,
            UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #ifndef U_HIDE_DEPRECATED_API
 
 #endif  /* U_HIDE_DEPRECATED_API */
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find a Unicode character by its name and return its code point value.
@@ -3600,7 +3600,7 @@
                const char *name,
                UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Type of a callback function for u_enumCharNames() that gets called
@@ -3625,7 +3625,7 @@
                                const char *name,
                                int32_t length);
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Enumerate all assigned Unicode characters between the start and limit
@@ -3655,9 +3655,9 @@
                 UCharNameChoice nameChoice,
                 UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Return the Unicode name for a given property, as given in the
@@ -3694,9 +3694,9 @@
 u_getPropertyName(UProperty property,
                   UPropertyNameChoice nameChoice) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Return the UProperty enum for a given property name, as specified
@@ -3720,9 +3720,9 @@
 U_STABLE UProperty U_EXPORT2
 u_getPropertyEnum(const char* alias) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Return the Unicode name for a given property value, as given in the
@@ -3776,9 +3776,9 @@
                        int32_t value,
                        UPropertyNameChoice nameChoice) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Return the property value integer for a given value name, as
@@ -3815,9 +3815,9 @@
 u_getPropertyValueEnum(UProperty property,
                        const char* alias) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character is permissible as the
@@ -3839,9 +3839,9 @@
 U_STABLE UBool U_EXPORT2
 u_isIDStart(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character is permissible
@@ -3867,9 +3867,9 @@
 U_STABLE UBool U_EXPORT2
 u_isIDPart(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character should be regarded
@@ -3894,9 +3894,9 @@
 U_STABLE UBool U_EXPORT2
 u_isIDIgnorable(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character is permissible as the
@@ -3917,9 +3917,9 @@
 U_STABLE UBool U_EXPORT2
 u_isJavaIDStart(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines if the specified character is permissible
@@ -3942,9 +3942,9 @@
 U_STABLE UBool U_EXPORT2
 u_isJavaIDPart(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * The given character is mapped to its lowercase equivalent according to
@@ -3971,9 +3971,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_tolower(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * The given character is mapped to its uppercase equivalent according to UnicodeData.txt;
@@ -4000,9 +4000,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_toupper(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * The given character is mapped to its titlecase equivalent
@@ -4029,9 +4029,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_totitle(UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * The given character is mapped to its case folding equivalent according to
@@ -4058,9 +4058,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_foldCase(UChar32 c, uint32_t options) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the decimal digit value of the code point in the
@@ -4103,9 +4103,9 @@
 U_STABLE int32_t U_EXPORT2
 u_digit(UChar32 ch, int8_t radix) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determines the character representation for a specific digit in
@@ -4138,9 +4138,9 @@
 U_STABLE UChar32 U_EXPORT2
 u_forDigit(int32_t digit, int8_t radix) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the "age" of the code point.
@@ -4159,9 +4159,9 @@
 U_STABLE void U_EXPORT2
 u_charAge(UChar32 c, UVersionInfo versionArray) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the Unicode version information.
@@ -4177,7 +4177,7 @@
 U_STABLE void U_EXPORT2
 u_getUnicodeVersion(UVersionInfo versionArray) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #if !UCONFIG_NO_NORMALIZATION
 
diff --git a/libicu/ndk_headers/unicode/uloc.h b/libicu/ndk_headers/unicode/uloc.h
index ab0d7cd..52ef8de 100644
--- a/libicu/ndk_headers/unicode/uloc.h
+++ b/libicu/ndk_headers/unicode/uloc.h
@@ -360,7 +360,7 @@
 } ULocDataLocaleType;
 
 #ifndef U_HIDE_SYSTEM_API
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets ICU's default locale.  
@@ -376,12 +376,12 @@
 U_STABLE const char* U_EXPORT2
 uloc_getDefault(void) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 #endif  /* U_HIDE_SYSTEM_API */
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the language code for the specified locale.
@@ -401,9 +401,9 @@
          int32_t languageCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the script code for the specified locale.
@@ -423,9 +423,9 @@
          int32_t scriptCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the  country code for the specified locale.
@@ -445,9 +445,9 @@
         int32_t countryCapacity,
         UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the variant code for the specified locale.
@@ -467,10 +467,10 @@
         int32_t variantCapacity,
         UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the full name for the specified locale.
@@ -494,9 +494,9 @@
          int32_t nameCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the full name for the specified locale.
@@ -521,9 +521,9 @@
          int32_t nameCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the ISO language code for the specified locale.
@@ -535,10 +535,10 @@
 U_STABLE const char* U_EXPORT2
 uloc_getISO3Language(const char* localeID) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the ISO country code for the specified locale.
@@ -550,11 +550,11 @@
 U_STABLE const char* U_EXPORT2
 uloc_getISO3Country(const char* localeID) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the language name suitable for display for the specified locale.
@@ -579,9 +579,9 @@
             int32_t languageCapacity,
             UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the script name suitable for display for the specified locale.
@@ -606,9 +606,9 @@
             int32_t scriptCapacity,
             UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the country name suitable for display for the specified locale.
@@ -635,10 +635,10 @@
                        int32_t countryCapacity,
                        UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the variant name suitable for display for the specified locale.
@@ -663,9 +663,9 @@
                        int32_t variantCapacity,
                        UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the keyword name suitable for display for the specified locale.
@@ -714,8 +714,8 @@
                        int32_t destCapacity,
                        UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
-#if __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the value of the keyword suitable for display for the specified locale.
@@ -745,8 +745,8 @@
                                int32_t destCapacity,
                                UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
-#if __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the full name suitable for display for the specified locale.
@@ -771,10 +771,10 @@
             int32_t maxResultSize,
             UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the specified locale from a list of available locales.
@@ -795,9 +795,9 @@
 U_STABLE const char* U_EXPORT2
 uloc_getAvailable(int32_t n) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the size of the all available locale list.
@@ -807,7 +807,7 @@
  */
 U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #ifndef U_HIDE_DRAFT_API
 
@@ -863,7 +863,7 @@
 
 #endif // U_HIDE_DRAFT_API
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  *
@@ -879,9 +879,9 @@
 U_STABLE const char* const* U_EXPORT2
 uloc_getISOLanguages(void) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  *
@@ -895,14 +895,14 @@
 U_STABLE const char* const* U_EXPORT2
 uloc_getISOCountries(void) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the full name for the specified locale, like uloc_getName(),
@@ -932,9 +932,9 @@
          int32_t nameCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets an enumeration of keywords for the specified locale. Enumeration
@@ -949,9 +949,9 @@
 uloc_openKeywords(const char* localeID,
                         UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the value for a keyword. Locale name does not need to be normalized.
@@ -972,10 +972,10 @@
                      char* buffer, int32_t bufferCapacity,
                      UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Sets or removes the value of the specified keyword.
@@ -1013,9 +1013,9 @@
                      char* buffer, int32_t bufferCapacity,
                      UErrorCode* status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns whether the locale's script is written right-to-left.
@@ -1034,7 +1034,7 @@
 U_STABLE UBool U_EXPORT2
 uloc_isRightToLeft(const char *locale) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * enums for the  return value for the character and line orientation
@@ -1049,7 +1049,7 @@
   ULOC_LAYOUT_UNKNOWN
 } ULayoutType;
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the layout character orientation for the specified locale.
@@ -1063,9 +1063,9 @@
 uloc_getCharacterOrientation(const char* localeId,
                              UErrorCode *status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Get the layout line orientation for the specified locale.
@@ -1079,7 +1079,7 @@
 uloc_getLineOrientation(const char* localeId,
                         UErrorCode *status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * enums for the 'outResult' parameter return value
@@ -1096,7 +1096,7 @@
 } UAcceptResult;
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Based on a HTTP header from a web browser and a list of available locales,
@@ -1117,9 +1117,9 @@
                             UEnumeration* availableLocales,
                             UErrorCode *status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Based on a list of available locales,
@@ -1141,13 +1141,13 @@
                     UEnumeration* availableLocales,
                     UErrorCode *status) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Add the likely subtags for a provided locale ID, per the algorithm described
@@ -1188,10 +1188,10 @@
          int32_t maximizedLocaleIDCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Minimize the subtags for a provided locale ID, per the algorithm described
@@ -1232,9 +1232,9 @@
          int32_t minimizedLocaleIDCapacity,
          UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns a locale ID for the specified BCP47 language tag string.
@@ -1266,9 +1266,9 @@
                     int32_t* parsedLength,
                     UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns a well-formed language tag for this locale ID. 
@@ -1298,9 +1298,9 @@
                    UBool strict,
                    UErrorCode* err) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Converts the specified keyword (legacy key, or BCP 47 Unicode locale
@@ -1326,9 +1326,9 @@
 U_STABLE const char* U_EXPORT2
 uloc_toUnicodeLocaleKey(const char* keyword) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Converts the specified keyword value (legacy type, or BCP 47
@@ -1361,9 +1361,9 @@
 U_STABLE const char* U_EXPORT2
 uloc_toUnicodeLocaleType(const char* keyword, const char* value) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Converts the specified keyword (BCP 47 Unicode locale extension key, or
@@ -1380,9 +1380,9 @@
 U_STABLE const char* U_EXPORT2
 uloc_toLegacyKey(const char* keyword) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Converts the specified keyword value (BCP 47 Unicode locale extension type,
@@ -1413,6 +1413,6 @@
 U_STABLE const char* U_EXPORT2
 uloc_toLegacyType(const char* keyword, const char* value) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #endif /*_ULOC*/
diff --git a/libicu/ndk_headers/unicode/ustring.h b/libicu/ndk_headers/unicode/ustring.h
index 6f5e71f..6357232 100644
--- a/libicu/ndk_headers/unicode/ustring.h
+++ b/libicu/ndk_headers/unicode/ustring.h
@@ -82,7 +82,7 @@
  * \ingroup ustring_strlen
  */
 /*@{*/
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Determine the length of an array of UChar.
@@ -94,10 +94,10 @@
 U_STABLE int32_t U_EXPORT2
 u_strlen(const UChar *s) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 /*@}*/
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Count Unicode code points in the length UChar code units of the string.
@@ -115,9 +115,9 @@
 U_STABLE int32_t U_EXPORT2
 u_countChar32(const UChar *s, int32_t length) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Check if the string contains more Unicode code points than a certain number.
@@ -140,9 +140,9 @@
 U_STABLE UBool U_EXPORT2
 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Concatenate two ustrings.  Appends a copy of <code>src</code>,
@@ -158,9 +158,9 @@
 u_strcat(UChar     *dst, 
     const UChar     *src) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Concatenate two ustrings.  
@@ -181,9 +181,9 @@
      const UChar     *src, 
      int32_t     n) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a substring in a string.
@@ -208,9 +208,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strstr(const UChar *s, const UChar *substring) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a substring in a string.
@@ -236,9 +236,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a BMP code point in a string.
@@ -260,9 +260,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strchr(const UChar *s, UChar c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a code point in a string.
@@ -284,9 +284,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strchr32(const UChar *s, UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a substring in a string.
@@ -311,9 +311,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strrstr(const UChar *s, const UChar *substring) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a substring in a string.
@@ -339,9 +339,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a BMP code point in a string.
@@ -363,9 +363,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strrchr(const UChar *s, UChar c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a code point in a string.
@@ -387,9 +387,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strrchr32(const UChar *s, UChar32 c) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Locates the first occurrence in the string <code>string</code> of any of the characters
@@ -406,9 +406,9 @@
 U_STABLE UChar * U_EXPORT2
 u_strpbrk(const UChar *string, const UChar *matchSet) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the number of consecutive characters in <code>string</code>,
@@ -426,9 +426,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strcspn(const UChar *string, const UChar *matchSet) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Returns the number of consecutive characters in <code>string</code>,
@@ -446,9 +446,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strspn(const UChar *string, const UChar *matchSet) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * The string tokenizer API allows an application to break a string into
@@ -480,9 +480,9 @@
      const UChar    *delim,
            UChar   **saveState) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings for bitwise equality (code unit order).
@@ -498,9 +498,9 @@
 u_strcmp(const UChar     *s1, 
          const UChar     *s2) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings in code point order.
@@ -516,9 +516,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings (binary order).
@@ -552,9 +552,9 @@
              const UChar *s2, int32_t length2,
              UBool codePointOrder) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings (binary order)
@@ -579,9 +579,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two strings case-insensitively using full case folding.
@@ -629,9 +629,9 @@
                  uint32_t options,
                  UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two ustrings for bitwise equality. 
@@ -650,9 +650,9 @@
      const UChar     *ucs2, 
      int32_t     n) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings in code point order.
@@ -670,9 +670,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two strings case-insensitively using full case folding.
@@ -696,9 +696,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two strings case-insensitively using full case folding.
@@ -724,9 +724,9 @@
 U_STABLE int32_t U_EXPORT2
 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two strings case-insensitively using full case folding.
@@ -752,9 +752,9 @@
 U_STABLE int32_t U_EXPORT2
 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Copy a ustring. Adds a null terminator.
@@ -768,9 +768,9 @@
 u_strcpy(UChar     *dst, 
     const UChar     *src) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Copy a ustring.
@@ -788,7 +788,7 @@
      const UChar     *src, 
      int32_t     n) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #if !UCONFIG_NO_CONVERSION
 
@@ -802,7 +802,7 @@
 
 #endif
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Synonym for memcpy(), but with UChars only.
@@ -815,9 +815,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memcpy(UChar *dest, const UChar *src, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Synonym for memmove(), but with UChars only.
@@ -830,9 +830,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memmove(UChar *dest, const UChar *src, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>.
@@ -846,9 +846,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memset(UChar *dest, UChar c, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare the first <code>count</code> UChars of each buffer.
@@ -864,9 +864,9 @@
 U_STABLE int32_t U_EXPORT2
 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Compare two Unicode strings in code point order.
@@ -884,9 +884,9 @@
 U_STABLE int32_t U_EXPORT2
 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a BMP code point in a string.
@@ -908,9 +908,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memchr(const UChar *s, UChar c, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the first occurrence of a code point in a string.
@@ -932,9 +932,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memchr32(const UChar *s, UChar32 c, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a BMP code point in a string.
@@ -956,9 +956,9 @@
 U_STABLE UChar* U_EXPORT2
 u_memrchr(const UChar *s, UChar c, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Find the last occurrence of a code point in a string.
@@ -980,7 +980,7 @@
 U_STABLE UChar* U_EXPORT2
 u_memrchr32(const UChar *s, UChar32 c, int32_t count) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Unicode String literals in C.
@@ -1067,7 +1067,7 @@
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Uppercase the characters in a string.
@@ -1095,9 +1095,9 @@
              const char *locale,
              UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Lowercase the characters in a string.
@@ -1125,11 +1125,11 @@
              const char *locale,
              UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #if !UCONFIG_NO_BREAK_ITERATION
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Titlecase a string.
@@ -1176,11 +1176,11 @@
              const char *locale,
              UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #endif
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Case-folds the characters in a string.
@@ -1212,14 +1212,14 @@
               uint32_t options,
               UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
 
 
 #endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-16 string to UTF-8.
@@ -1251,9 +1251,9 @@
             int32_t srcLength,
             UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-8 string to UTF-16.
@@ -1285,9 +1285,9 @@
               int32_t srcLength,
               UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-16 string to UTF-8.
@@ -1333,9 +1333,9 @@
             UChar32 subchar, int32_t *pNumSubstitutions,
             UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-8 string to UTF-16.
@@ -1382,9 +1382,9 @@
               UChar32 subchar, int32_t *pNumSubstitutions,
               UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-8 string to UTF-16.
@@ -1445,9 +1445,9 @@
                      int32_t srcLength,
                      UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-16 string to UTF-32.
@@ -1479,9 +1479,9 @@
              int32_t  srcLength,
              UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-32 string to UTF-16.
@@ -1513,9 +1513,9 @@
                int32_t srcLength,
                UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-16 string to UTF-32.
@@ -1561,9 +1561,9 @@
              UChar32 subchar, int32_t *pNumSubstitutions,
              UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Convert a UTF-32 string to UTF-16.
@@ -1609,7 +1609,7 @@
                UChar32 subchar, int32_t *pNumSubstitutions,
                UErrorCode *pErrorCode) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 
diff --git a/libicu/ndk_headers/unicode/utypes.h b/libicu/ndk_headers/unicode/utypes.h
index e21e5da..df995a8 100644
--- a/libicu/ndk_headers/unicode/utypes.h
+++ b/libicu/ndk_headers/unicode/utypes.h
@@ -709,7 +709,7 @@
 #   define U_FAILURE(x) ((x)>U_ZERO_ERROR)
 #endif
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Return a string for a UErrorCode value.
@@ -720,7 +720,7 @@
 U_STABLE const char * U_EXPORT2
 u_errorName(UErrorCode code) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 
 #endif /* _UTYPES */
diff --git a/libicu/ndk_headers/unicode/uversion.h b/libicu/ndk_headers/unicode/uversion.h
index 874614a..89ad056 100644
--- a/libicu/ndk_headers/unicode/uversion.h
+++ b/libicu/ndk_headers/unicode/uversion.h
@@ -135,7 +135,7 @@
 
 
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Write a string with dotted-decimal version information according
@@ -152,9 +152,9 @@
 U_STABLE void U_EXPORT2
 u_versionToString(const UVersionInfo versionArray, char *versionString) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
-#if __ANDROID_API__ >= 31
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 31
 
 /**
  * Gets the ICU release version.  The version array stores the version information
@@ -167,5 +167,5 @@
 U_STABLE void U_EXPORT2
 u_getVersion(UVersionInfo versionArray) __INTRODUCED_IN(31);
 
-#endif // __ANDROID_API__ >= 31
+#endif // !defined(__ANDROID__) || __ANDROID_API__ >= 31
 #endif
diff --git a/tools/icu4c_srcgen/generate_ndk.py b/tools/icu4c_srcgen/generate_ndk.py
index b4e09dd..4fdc144 100755
--- a/tools/icu4c_srcgen/generate_ndk.py
+++ b/tools/icu4c_srcgen/generate_ndk.py
@@ -69,9 +69,9 @@
 def get_replacement_adding_api_level_macro(api_level):
     """Return the replacement string adding the NDK C macro
     guarding C function declaration by the api_level"""
-    return r"#if __ANDROID_API__ >= {0}\n\n" \
+    return r"#if !defined(__ANDROID__) || __ANDROID_API__ >= {0}\n\n" \
            r"\1 __INTRODUCED_IN({0});\n\n" \
-           r"#endif // __ANDROID_API__ >= {0}".format(api_level)
+           r"#endif // !defined(__ANDROID__) || __ANDROID_API__ >= {0}".format(api_level)
 
 def modify_func_declarations(src_path, dst_path, decl_names):
     """Process the source file,