From b3d75959a87fa082445e622d436844573873a9a4 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 16 Apr 2021 14:38:57 -0700 Subject: [PATCH] Upgrade to Guava 30.1, which warns on Java 7 This change can have large impact from two aspects: 1. It calls out a _large_ impact on the _few_ Java 7 users. 2. It may have _small_ impact on the _many_ Android users. https://github.com/grpc/grpc-java/issues/4671 tracks gRPC's removal of Java 7 support. We are quite eager to drop Java 7 support as that would allow using new language features like default methods. Guava is also dropping Java 7 support and starting in 30.1 it will warn when used on Java 7. The purpose of the warning is to help discover users that are negatively impacted by dropping Java 7 before it becomes a bigger problem. The Guava logging check was implemented in such a way that there is an optional class that uses Java 8 bytecode. While the class is optional at runtime, the Android build system notices when dexing and fails if Java 8 language featutres are not enabled. We believe this will not be a problem for most Android users, but they may need to add to their build: ``` android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } ``` See also https://github.com/google/guava/releases/tag/v30.1 --- android-interop-testing/build.gradle | 4 ++++ android/build.gradle | 4 ++++ build.gradle | 2 +- examples/android/clientcache/app/build.gradle | 4 ++++ examples/android/helloworld/app/build.gradle | 4 ++++ examples/android/routeguide/app/build.gradle | 4 ++++ examples/android/strictmode/app/build.gradle | 4 ++++ 7 files changed, 25 insertions(+), 1 deletion(-) diff --git a/android-interop-testing/build.gradle b/android-interop-testing/build.gradle index 91e75fcfad8..7cefa2ea28a 100644 --- a/android-interop-testing/build.gradle +++ b/android-interop-testing/build.gradle @@ -25,6 +25,10 @@ android { } } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 26 defaultConfig { diff --git a/android/build.gradle b/android/build.gradle index 1fa8fbad937..0f802a66606 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,6 +8,10 @@ plugins { description = 'gRPC: Android' android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 29 defaultConfig { consumerProguardFiles "proguard-rules.txt" diff --git a/build.gradle b/build.gradle index 56d28697f5e..36ccf753e0f 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ subprojects { javaPluginPath = "$rootDir/compiler/build/exe/java_plugin/$protocPluginBaseName$exeSuffix" nettyVersion = '4.1.52.Final' - guavaVersion = '30.0-android' + guavaVersion = '30.1-android' googleauthVersion = '0.22.2' protobufVersion = '3.12.0' protocVersion = protobufVersion diff --git a/examples/android/clientcache/app/build.gradle b/examples/android/clientcache/app/build.gradle index 91eb289cb0a..b13afd88411 100644 --- a/examples/android/clientcache/app/build.gradle +++ b/examples/android/clientcache/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 27 defaultConfig { diff --git a/examples/android/helloworld/app/build.gradle b/examples/android/helloworld/app/build.gradle index 057b27e8bb3..24351d62439 100644 --- a/examples/android/helloworld/app/build.gradle +++ b/examples/android/helloworld/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 27 defaultConfig { diff --git a/examples/android/routeguide/app/build.gradle b/examples/android/routeguide/app/build.gradle index 83b8b97ec04..e01287c6098 100644 --- a/examples/android/routeguide/app/build.gradle +++ b/examples/android/routeguide/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 27 defaultConfig { diff --git a/examples/android/strictmode/app/build.gradle b/examples/android/strictmode/app/build.gradle index b6cd8f11e96..552b5a3bb90 100644 --- a/examples/android/strictmode/app/build.gradle +++ b/examples/android/strictmode/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' android { + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } compileSdkVersion 28 defaultConfig {