Skip to content

android-interop-testing: Replace deprecated classes#7

Merged
shivaspeaks merged 1 commit intomasterfrom
replace-deprecated-classes
Mar 12, 2026
Merged

android-interop-testing: Replace deprecated classes#7
shivaspeaks merged 1 commit intomasterfrom
replace-deprecated-classes

Conversation

@shivaspeaks
Copy link
Copy Markdown
Owner

No description provided.

@shivaspeaks shivaspeaks reopened this Mar 12, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on updating the Android compatibility and dependencies within the gRPC-Java project. It advances the minimum supported Android SDK version to Marshmallow (API 23), allowing for the removal of older compatibility layers like MultiDex. Additionally, it updates internal gRPC versions, modernizes Android testing APIs, refines DNS resolution behavior on Android, and improves load balancer connection logic, ensuring better alignment with current Android development practices and gRPC internal mechanisms.

Highlights

  • gRPC Version Update: Upgraded the gRPC version to 1.81.0-SNAPSHOT across the entire project, affecting build files, generated code, and various examples.
  • Android API Level Bump: Increased the minimum Android SDK version (minSdkVersion) from 20/21/22 to 23 (Marshmallow) in all relevant Android modules and examples, enhancing compatibility with modern Android features.
  • MultiDex Removal: Eliminated MultiDex support configurations and dependencies, as minSdkVersion 23 natively supports multi-dexing, simplifying the build process.
  • Android Testing API Modernization: Migrated Android testing utilities in UdsChannelInteropTest.java from deprecated InstrumentationRegistry and ActivityTestRule to their modern androidx.test.platform.app.InstrumentationRegistry and ActivityScenarioRule equivalents.
  • DNS Resolution on Android: Adjusted DnsNameResolver behavior on Android to utilize a fixed DNS cache TTL instead of ignoring it, along with updated documentation and tests.
  • Load Balancer Connection Logic: Enhanced PickFirstLeafLoadBalancer to prevent redundant connection requests when a reconnection task is already active, improving efficiency.
  • Cronet Network Binding Simplification: Updated CronetChannelBuilder by removing an unnecessary Android SDK version check for network binding, aligning with the new minSdkVersion.
  • Name Resolver URI Handling: Refactored SecretGrpclbNameResolverProvider to support the new Uri class and introduced parameterized tests for robust URI path segment validation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • MODULE.bazel
    • Updated the grpc-java module version to 1.81.0-SNAPSHOT.
  • README.md
    • Updated the minimum Android SDK version mentioned in the supported platforms section to 23.
  • android-interop-testing/build.gradle
    • Increased minSdkVersion to 23, removed multiDexEnabled flag, and added grpc-api as an implementation dependency.
  • android-interop-testing/src/androidTest/AndroidManifest.xml
    • Removed the explicit android.support.multidex.MultiDexApplication declaration.
  • android-interop-testing/src/androidTest/java/io/grpc/android/integrationtest/UdsChannelInteropTest.java
    • Replaced deprecated InstrumentationRegistry and ActivityTestRule with androidx.test.platform.app.InstrumentationRegistry and ActivityScenarioRule.
  • android-interop-testing/src/main/AndroidManifest.xml
    • Removed the explicit androidx.multidex.MultiDexApplication declaration.
  • android/build.gradle
    • Increased minSdkVersion to 23.
  • binder/build.gradle
    • Increased minSdkVersion to 23 and removed multiDexEnabled flag.
  • build.gradle
    • Updated the global grpcVersion to 1.81.0-SNAPSHOT.
  • compiler/src/test/golden/TestDeprecatedService.java.txt
    • Updated the generated gRPC proto compiler version to 1.81.0-SNAPSHOT.
  • compiler/src/test/golden/TestService.java.txt
    • Updated the generated gRPC proto compiler version to 1.81.0-SNAPSHOT.
  • core/src/main/java/io/grpc/internal/DnsNameResolver.java
    • Modified the DNS cache TTL behavior for Android to use a fixed value instead of ignoring it, and updated comments.
  • core/src/main/java/io/grpc/internal/GrpcUtil.java
    • Updated the IMPLEMENTATION_VERSION constant to 1.81.0-SNAPSHOT.
  • core/src/main/java/io/grpc/internal/PickFirstLeafLoadBalancer.java
    • Added a condition to prevent requestConnection calls when a reconnectTask is already active.
  • core/src/test/java/io/grpc/internal/DnsNameResolverTest.java
    • Removed Android-specific resolveNeverCache tests and updated resolveDefaultValue to be parameterized for Android.
  • core/src/test/java/io/grpc/internal/PickFirstLeafLoadBalancerTest.java
    • Added a conditional check for serializeRetries before verifying subchannel start.
  • cronet/build.gradle
    • Increased minSdkVersion to 23.
  • cronet/src/main/java/io/grpc/cronet/CronetChannelBuilder.java
    • Removed the Build.VERSION.SDK_INT check for bindToNetwork as minSdkVersion is now 23.
  • examples/MODULE.bazel
    • Updated the grpc-java module version to 1.81.0-SNAPSHOT.
  • examples/android/clientcache/app/build.gradle
    • Increased minSdkVersion to 23, removed multiDexEnabled, and updated gRPC dependency versions.
  • examples/android/helloworld/app/build.gradle
    • Increased minSdkVersion to 23 and updated gRPC dependency versions.
  • examples/android/routeguide/app/build.gradle
    • Increased minSdkVersion to 23 and updated gRPC dependency versions.
  • examples/android/strictmode/app/build.gradle
    • Updated gRPC dependency versions.
  • examples/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-alts/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-debug/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-debug/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-dualstack/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-dualstack/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-gauth/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-gauth/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-gcp-csm-observability/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-gcp-observability/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-hostname/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-hostname/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-jwt-auth/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-jwt-auth/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-oauth/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-oauth/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-opentelemetry/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-orca/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-reflection/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-servlet/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-tls/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/example-tls/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • examples/example-xds/build.gradle
    • Updated the grpcVersion variable to 1.81.0-SNAPSHOT.
  • examples/pom.xml
    • Updated the grpc.version and project version to 1.81.0-SNAPSHOT.
  • grpclb/src/main/java/io/grpc/grpclb/SecretGrpclbNameResolverProvider.java
    • Added a new newNameResolver method that accepts io.grpc.Uri and refactored URI parsing logic.
  • grpclb/src/test/java/io/grpc/grpclb/SecretGrpclbNameResolverProviderTest.java
    • Converted the test class to parameterized, added new tests for io.grpc.Uri handling, and updated existing URI validation tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly replaces deprecated Android testing classes (ActivityTestRule, InstrumentationRegistry) with their modern equivalents (ActivityScenarioRule, androidx.test.platform.app.InstrumentationRegistry). The changes are straightforward and improve the maintainability of the test code by aligning with current Android testing best practices. The implementation is correct, and I have no further suggestions.

@shivaspeaks shivaspeaks merged commit b20c32c into master Mar 12, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant