question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes on start when using Firebase In-App Messaging on Android 11

See original GitHub issue

[READ] Step 1: Are you in the right place?

Yes

[REQUIRED] Step 2: Describe your environment

  • Firebase Component: In-App Messaging
  • Component version: 19.1.5

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I was able to reproduce the issue with LineageOS 18.1 (Android 11) without Google Apps (so no Google Play services) on a OnePlus 6T. A user of my app has the same issue with LineageOS on a OnePlus 7T Pro, also without Google Apps. I was not able to reproduce the issue on a Samsung Android 11 phone (stock firmware with Google Apps).

When opening the app it crashes with the following error:

java.lang.AssertionError: Method getAlpnSelectedProtocol not supported for object SSL socket over Socket[address=firebaseinappmessaging.googleapis.com/216.58.214.10,port=443,localPort=37744]
    at io.grpc.okhttp.internal.OptionalMethod.invoke(OptionalMethod.java:114)
    at io.grpc.okhttp.internal.OptionalMethod.invokeWithoutCheckedException(OptionalMethod.java:135)
    at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.getSelectedProtocol(OkHttpProtocolNegotiator.java:183)
    at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:145)
    at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:63)
    at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:571)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)

This error has been fixed in gRPC here: https://github.com/grpc/grpc-java/commit/5803dfd9dcca0fba4483fccf724efc1c853a3ada

It looks like Firebase In-App Messaging is currently using 1.28.0 which does not contain this fix. I tested gRPC version 1.32.2 which works fine on my test device. Please update the gRPC library in Firebase In-App Messaging.

Relevant Code:

Add the following in build.gradle.kts:

implementation("com.google.firebase:firebase-inappmessaging-display-ktx:19.1.5")
// Note that I am also using other Firebase components like Analytics, Crashlytics, and Remote Config.

Workaround:

Add the following in build.gradle.kts:

implementation("io.grpc:grpc-okhttp:1.32.2")

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
Thomas-Voscommented, Jul 6, 2021

@aguatno please re-open the issue as this has not been fixed in Firebase yet.

You can see here: https://github.com/firebase/firebase-android-sdk/blob/4ec27259f9db716a11e521db42677a33902f0945/build.gradle#L49 that the gRPC version is 1.28.0 in Firebase. That version does not contain the fix. This dependency needs to be updated to a higher version, for example gRPC 1.32.2 works for me.

2reactions
raghav2945commented, Dec 4, 2021

Hello Team,

We are experiencing the same problem with our application (Audiomack), and the primary stated device OS version is 11 and the manufacturer is Xiaomi. For reference, I’m sharing the stack trace.

We are currently using the in-app messaging version - implementation ‘com.google.firebase:firebase-inappmessaging-display:20.1.1’.

Fatal Exception: java.lang.AssertionError: Method getAlpnSelectedProtocol not supported for object SSL socket over Socket[address=firebaseinappmessaging.googleapis.com/216.58.221.202,port=443,localPort=45004] at io.grpc.okhttp.internal.OptionalMethod.invoke(OptionalMethod.java:114) at io.grpc.okhttp.internal.OptionalMethod.invokeWithoutCheckedException(OptionalMethod.java:135) at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.getSelectedProtocol(OkHttpProtocolNegotiator.java:183) at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:145) at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:63) at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:571) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:923)

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found