android-studio - Android 11 sdk 30 上的 Okhttp 异常 java.lang.AssertionError
问题描述
我使用com.squareup.okhttp3:okhttp:4.4.1
但何时应显示来自应用程序消息传递中的 firebase 的消息(当应用程序启动时)应用程序在 11 android 上崩溃。我根本不使用 mainactivity 中的 Okhttp。使用'com.google.firebase:firebase-inappmessaging-display:19.1.5'
试过不同版本的
okhttp and firebase inappmessaging display
Fatal Exception: java.lang.AssertionError
Method getAlpnSelectedProtocol not supported for object SSL socket over Socket[address=firebaseinappmessaging.googleapis.com/***,port=*,localPort=*
Fatal Exception: java.lang.AssertionError: Method getAlpnSelectedProtocol not supported for object SSL socket over Socket[address=firebaseinappmessaging.googleapis.com/***,port=*,localPort=*]
at io.grpc.okhttp.internal.OptionalMethod.invoke(OptionalMethod.java:67)
at io.grpc.okhttp.internal.OptionalMethod.invokeWithoutCheckedException(OptionalMethod.java)
at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.b(OkHttpProtocolNegotiator.java:15)
at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java)
at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:8)
at io.grpc.okhttp.OkHttpClientTransport$4.run(OkHttpClientTransport.java:17)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:11)
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)
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation('com.google.android.material:material:1.3.0') {
exclude group: 'androidx'
}
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation('androidx.lifecycle:lifecycle-extensions:2.2.0') {
exclude group: 'androidx'
}
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation('com.squareup.picasso:picasso:2.71828') {
exclude group: 'com.android.support'
exclude module: ['exifinterface', 'support-annotations']
}
implementation 'com.jakewharton:butterknife:10.2.3'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.r0adkll:slidableactivity:2.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'de.hdodenhof:circleimageview:3.1.0'
//noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
implementation 'com.google.android.exoplayer:exoplayer:2.10.4'
implementation 'com.google.android.exoplayer:extension-okhttp:2.10.4'
implementation('com.google.firebase:firebase-analytics:18.0.2') {
exclude group: 'androidx'
}
implementation('com.google.firebase:firebase-core:18.0.2') {
exclude group: 'androidx'
}
implementation('com.google.firebase:firebase-perf:19.1.1') {
exclude group: 'androidx'
}
implementation 'tech.schoolhelper:moxy-x-androidx:1.7.0'
implementation 'com.google.firebase:firebase-crashlytics:17.3.1'
implementation 'tech.schoolhelper:moxy-x:1.7.0'
annotationProcessor 'tech.schoolhelper:moxy-x-compiler:1.7.0'
implementation 'tech.schoolhelper:moxy-x-androidx:1.7.0'
implementation 'tech.schoolhelper:moxy-x-material:1.7.0'
implementation 'com.android.support:preference-v7:30.0.0'
implementation 'pub.devrel:easypermissions:0.2.0'
implementation 'com.github.codekidX:storage-chooser:2.0.4.4'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'com.google.firebase:firebase-ads:19.7.0'
implementation('com.android.billingclient:billing:3.0.2') {
exclude group: 'androidx'
}
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
implementation 'com.alimuzaffar.lib:pinentryedittext:2.0.6'
implementation 'com.mindorks.android:prdownloader:0.6.0'
implementation('com.stepstone.apprating:app-rating:2.3.1') {
exclude group: 'androidx'
}
implementation 'com.diogobernardino:williamchart:2.2'
implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:1.0.0'
implementation('com.google.firebase:firebase-inappmessaging-display:19.1.5') {
exclude group: 'androidx'
}
implementation 'com.google.android.exoplayer:exoplayer:2.10.4'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'it.xabaras.android:recyclerview-swipedecorator:1.2.3'
解决方案
这是一个已知问题https://github.com/firebase/firebase-android-sdk/issues/2642
可能的解决方法
implementation('com.google.firebase:firebase-inappmessaging-display:19.1.5', {
exclude group: 'io.grpc', module: 'grpc-okhttp'
})
implementation 'io.grpc:grpc-okhttp:1.32.2'
推荐阅读
- c# - c#构造函数通过反射获取'base'部分
- javascript - 如何在 Adobe 的 pdf 嵌入 API 中使用变量作为 URL 值?
- c# - 无法将类型 bool 隐式转换为 unity Engine Animator PlayerPrefs
- javascript - 无法使用表单变量访问 JavaScript 表单元素
- imagemagick - 通过使用 imagemagick 的隐蔽命令来使用 ghostscript 的 -dprinted 选项
- regex - 我似乎无法构建这个简单的正则表达式
- javascript - 在 React/Redux 的嵌套数组中更新嵌套对象
- reactjs - 用 Typescript 反应 styled-component,类型错误
- assembly - RTC 只发送一次中断信号
- r - Tableau 中的保留错误。异常:外部服务器套接字失败