Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to initialize using R8 in full mode on Android #54

Closed
samsonjs opened this issue Jun 21, 2023 · 1 comment
Closed

Failure to initialize using R8 in full mode on Android #54

samsonjs opened this issue Jun 21, 2023 · 1 comment

Comments

@samsonjs
Copy link

We're using this library on Android and that tooling has been updated to enable R8's full optimization mode by default. This is causing a runtime failure when trying to use the SDK:

java.lang.ExceptionInInitializerError
	at com.google.api.gax.grpc.GaxGrpcProperties.getGrpcTokenName(Unknown Source:0)
	at com.google.photos.library.v1.internal.stub.PhotosLibraryStubSettings.defaultApiClientHeaderProviderBuilder(SourceFile:17)
	at com.google.photos.library.v1.internal.stub.PhotosLibraryStubSettings$Builder.createDefault(SourceFile:25)
	at com.google.photos.library.v1.internal.stub.PhotosLibraryStubSettings$Builder.access$400(Unknown Source:0)
	at com.google.photos.library.v1.internal.stub.PhotosLibraryStubSettings.newBuilder(SourceFile:1)
	at com.google.photos.library.v1.PhotosLibrarySettings$Builder.createDefault(Unknown Source:2)
	at com.google.photos.library.v1.PhotosLibrarySettings.newBuilder(Unknown Source:0)
	[... elided ...]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$c.run(Unknown Source:0)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [cn5{Cancelling}@59d8b6f, Dispatchers.IO]
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getImplementationVersion()' on a null object reference
	at com.google.api.gax.core.GaxProperties.getLibraryVersion(SourceFile:1)
	at com.google.api.gax.core.GaxProperties.getLibraryVersion(SourceFile:3)
	at com.google.api.gax.grpc.GaxGrpcProperties.<clinit>(SourceFile:15)
	... 31 more

The class loader isn't finding the package for com.google.photos.api.grpc.GaxGrpcProperties and there's a null-pointer exception in GaxProperties.getLibraryVersion(). I've confirmed that our app contains both of those classes so I'm at a loss as to why the class loader can't find it.

Any ideas or pointers would be very much appreciated if this isn't a bug in this library. I'm at a loss as to how to proceed.

CleanShot 2023-06-20 at 10 42 21@2x

CleanShot 2023-06-20 at 10 42 41@2x

@samsonjs
Copy link
Author

Looks like one of our ProGuard rules for R8 is responsible for the problem here.

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

No branches or pull requests

1 participant