grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

Upgrade to AGP 8

Open ejona86 opened this issue 2 years ago • 3 comments

To upgrade to Gradle 8 we will need to upgrade to Android Gradle Plugin 8. And that will require Java 17. It also enables things like R8 full mode.

ejona86 avatar May 08 '23 17:05 ejona86

I've got a problem that might be related to this.

I'm using these two dependencies:

implementation "io.grpc:grpc-okhttp:1.48.1" implementation "io.grpc:grpc-android:1.48.1"

on my Android project. I've tried updating Gradle to 8. Everything looks good except for the task:

minifyJottacloudReleaseWithR8 where I get a bunch of missing classes, especially a couple of interesting ones:

Missing class javax.naming.NamingEnumeration (referenced from: void io.grpc.internal.JndiResourceResolverFactory$JndiRecordFetcher.closeThenThrow(javax.naming.NamingEnumeration, javax.naming.NamingException) and 1 other context)
Missing class javax.naming.NamingException (referenced from: void io.grpc.internal.JndiResourceResolverFactory$JndiRecordFetcher.closeThenThrow(javax.naming.NamingEnumeration, javax.naming.NamingException) and 4 other contexts) 

I've tried ignoring them with this on the proguard file:

-dontwarn javax.naming.**

But then I get a lot of runtime crashes stating:

Fatal Exception: java.lang.IllegalAccessError: Illegal class access ('xxx.xxx.LogInterceptor$interceptCall$1$start$listener$1' attempting to access 'io.grpc.PartialForwardingClientCallListener') in attempt to invoke super method void io.grpc.PartialForwardingClientCallListener.onClose(io.grpc.Metadata, io.grpc.Status) (declaration of 'xxx.xxx.LogInterceptor$interceptCall$1$start$listener$1' appears in base.apk!classes3.dex)

My guess is that grpc-okhttp or grpc-android are using javax.naming references which don't exist in java 17 anymore, and there's nothing I can do about it.

I'm putting this Gradle update on stale until you guys fix it.

DevDema avatar May 09 '23 09:05 DevDema

@DevDema, this is for our internal build, so should not be used for your issues.

That first part looks to be the same as #10057. It is safe to ignore. Those JNDI classes have never existed on Android. See #5422 for previous discussion for those classes.

Open a separate issue for that PartialForwardingClientCallListener issue. That seems to be because ForwardingClientCallListener extends PartialForwardingClientCallListener, but PartialForwardingClientCallListener is package-private. Seems like an R8 or Android bug, but we'll also need to see what we can do about it.

ejona86 avatar May 09 '23 15:05 ejona86

What is the progress on this issue? The https://github.com/bazelbuild/bazel/issues/18743 was closed almost one year ago? A lots of dependencies are not up to date because of this issue.

marcindabrowski avatar Aug 25 '25 07:08 marcindabrowski