The module metadata in Guava causes the -jre version to be selected even when you choose the -android version. Gradle did not give any clues that this was happening, and while `println(configurations.compileClasspath.resolve())` shows the different jar in use, most other diagonstics don't. dependencyInsight can show you this is happening, but only if you know which dependency has a problem and read Guava's module metadata first to understand the significance of the results. You could argue this is a Guava-specific problem. I was able to get parts of our build working with attributes and resolutionStrategy configurations mentioned at https://github.com/google/guava/releases/tag/v32.1.0 , so that only Guava would be changed. But it was fickle giving poor error messages or silently swapping back to the -jre version. Given the weak debuggability, the added complexity, and the lack of value module metadata is providing us, disabling module metadata for our entire build seems prudent. See https://github.com/google/guava/issues/7575 |
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| README.md | ||
| build.gradle | ||
| proguard-rules.pro | ||
README.md
gRPC Cronet Transport
EXPERIMENTAL: gRPC's Cronet transport is an experimental API. Its stability depends on upstream Cronet's implementation, which involves some experimental features.
This code enables using the Chromium networking stack (Cronet) as the transport layer for gRPC on Android. This lets your Android app make RPCs using the same networking stack as used in the Chrome browser.
Some advantages of using Cronet with gRPC:
- Bundles an OpenSSL implementation, enabling TLS connections even on older versions of Android without additional configuration
- Robust to Android network connectivity changes
- Support for QUIC
Since gRPC's 1.24 release, the grpc-cronet package provides access to the
CronetChannelBuilder class. Cronet jars are available on Google's Maven repository.
See the example app at https://github.com/GoogleChrome/cronet-sample/blob/master/README.md.
Example usage:
In your app module's build.gradle file, include a dependency on both
io.grpc:grpc-cronet and the Google Play Services Client Library for Cronet,
com.google.android.gms:play-services-cronet.
In cases where Cronet cannot be loaded from Google Play services, there is a less performant
implementation of Cronet's API that can be used. Depend on org.chromium.net:cronet-fallback
to use this fall-back implementation.
You will also need permission to access the device's network state in your
AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Once the above steps are completed, you can create a gRPC Cronet channel as follows:
import io.grpc.cronet.CronetChannelBuilder;
import org.chromium.net.ExperimentalCronetEngine;
...
ExperimentalCronetEngine engine =
new ExperimentalCronetEngine.Builder(context /* Android Context */).build();
ManagedChannel channel = CronetChannelBuilder.forAddress("localhost", 8080, engine).build();