Assert Android API >= v21 (#27943)

* Assert Android API >= v21

This precedes a change that would otherwise break on older Android APIs,
but in a more obvious way.

* error if __ANDROID_API__ is not defined

* update all Andriod minSdkVersions to 21

* csharp experimental: android-19 to 21
pull/27967/head
AJ Heller 3 years ago committed by GitHub
parent b8492651e5
commit 83868b695e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      examples/android/helloworld/app/build.gradle
  2. 2
      examples/csharp/HelloworldUnity/ProjectSettings/ProjectSettings.asset
  3. 8
      include/grpc/impl/codegen/port_platform.h
  4. 2
      src/android/test/interop/app/build.gradle
  5. 4
      src/csharp/experimental/build_native_ext_for_android.sh

@ -4,7 +4,7 @@ android {
compileSdkVersion 26
defaultConfig {
applicationId "io.grpc.android.cpp.helloworldexample"
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"

@ -153,7 +153,7 @@ PlayerSettings:
iOS: com.jattermusch.grpc.example
buildNumber: {}
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:

@ -126,11 +126,15 @@
#elif defined(ANDROID) || defined(__ANDROID__)
#define GPR_PLATFORM_STRING "android"
#define GPR_ANDROID 1
#ifdef __ANDROID_API__
#ifndef __ANDROID_API__
#error "__ANDROID_API__ must be defined for Android builds."
#endif
#if __ANDROID_API__ < 21
#error "Requires Android API v21 and above"
#endif
#if (__ANDROID_API__) >= 23
#define GPR_SUPPORT_BINDER_TRANSPORT 1
#endif
#endif
// TODO(apolcyn): re-evaluate support for c-ares
// on android after upgrading our c-ares dependency.
// See https://github.com/grpc/grpc/issues/18038.

@ -4,7 +4,7 @@ android {
compileSdkVersion 26
defaultConfig {
applicationId "io.grpc.android.interop.cpp"
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"

@ -36,7 +36,7 @@ cd build
# ANDROID_ABI in ('arm64-v8a', 'armeabi-v7a')
# e.g. ANDROID_ABI=armeabi-v7a
# android-19 corresponds to Kitkat 4.4
# android-21 corresponds to Lollipop 5.0
${ANDROID_SDK_CMAKE} ../.. \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_PATH}/build/cmake/android.toolchain.cmake" \
-DCMAKE_ANDROID_NDK="${ANDROID_NDK_PATH}" \
@ -45,7 +45,7 @@ ${ANDROID_SDK_CMAKE} ../.. \
-DRUN_HAVE_STD_REGEX=0 \
-DRUN_HAVE_STEADY_CLOCK=0 \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_PLATFORM=android-19 \
-DANDROID_PLATFORM=android-21 \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_NDK="${ANDROID_NDK_PATH}" \
-DgRPC_XDS_USER_AGENT_IS_CSHARP=ON

Loading…
Cancel
Save