Firebase Android 中的 java.lang.AbstractMethodError (FirebaseInstallationServiceClient.readGenerateAuthTokenResponse)
我们遇到过这样的崩溃,在 Play 管理中心中已经发生了大约 110 万次,而且还在不断增加,但没有成功找出原因。
报告:
java.lang.AbstractMethodError:
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.readGenerateAuthTokenResponse (FirebaseInstallationServiceClient.java:569)
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.generateAuthToken (FirebaseInstallationServiceClient.java:421)
at com.google.firebase.installations.FirebaseInstallations.fetchAuthTokenFromServer (FirebaseInstallations.java:566)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary (FirebaseInstallations.java:390)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2 (FirebaseInstallations.java:377)
at com.google.firebase.installations.FirebaseInstallations.$r8$lambda$VZq1h0TBcWNH8Y5yY86ujrFFyLo (FirebaseInstallations.java)
at com.google.firebase.installations.FirebaseInstallations$$InternalSyntheticLambda$0$8f6250a76dc84afdee54bd79d6c6b27858a3db00ee2f9ff4dae9d6825fe4cbe4$0.run$bridge (FirebaseInstallations.java:18)
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:920)
我们需要处理的事情就很少了……它似乎完全包含在 Firebase SDK 中。
团队中的任何人都无法重现该崩溃,并且所有预发布测试设备均未出现任何问题或任何大规模设备测试服务。从我们测试的任何方式来看,Firebase Messaging 似乎都运行良好。
我们当时
com.google.firebase:firebase-messaging:20.x.x
就更新到
com.google.firebase:firebase-messaging:23.0.0
没有任何变化,崩溃仍然每小时发生。
我们删除了之前的一项更新:android.permission.ACCESS_BACKGROUND_LOCATION 以符合最近的更改。然而,它是一个遗物,并且该应用程序实际上多年来并不需要它。
这似乎是崩溃开始的时候,尽管据我所知,Firebase SDK 不需要此权限,也不需要它,但我们正在抓住救命稻草。
一些构建变量:
minSdkVersion 19
targetSdkVersion 30
compileSdkVersion 30
buildToolsVersion 32.0.0
Gradle 7.1.2
android.enableJetifier=true
android.enableR8=true
android.enableR8.fullMode=true
android.useAndroidX=true
感觉像是一个构建问题,因为我们的代码库变化很小(在尝试 Firebase SDK 更新之前有一个清单 perm 行)...但我们只是运气不佳并不是每个遇到它的人的差异都是奇特的。
We have this crash that in Play Console has occurred some 1.1million times and counting, with no success figuring out why.
The report:
java.lang.AbstractMethodError:
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.readGenerateAuthTokenResponse (FirebaseInstallationServiceClient.java:569)
at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.generateAuthToken (FirebaseInstallationServiceClient.java:421)
at com.google.firebase.installations.FirebaseInstallations.fetchAuthTokenFromServer (FirebaseInstallations.java:566)
at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary (FirebaseInstallations.java:390)
at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2 (FirebaseInstallations.java:377)
at com.google.firebase.installations.FirebaseInstallations.$r8$lambda$VZq1h0TBcWNH8Y5yY86ujrFFyLo (FirebaseInstallations.java)
at com.google.firebase.installations.FirebaseInstallations$InternalSyntheticLambda$0$8f6250a76dc84afdee54bd79d6c6b27858a3db00ee2f9ff4dae9d6825fe4cbe4$0.run$bridge (FirebaseInstallations.java:18)
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:920)
There's little more we have to work with...it is seemingly entirely contained in the Firebase SDK.
The crash is not reproducible by anyone on team and none of the pre-launch test devices exhibit any issue or any mass device testing service. Firebase Messaging appears to be working fine in any manner we can test.
We were on
com.google.firebase:firebase-messaging:20.x.x
So we updated to
com.google.firebase:firebase-messaging:23.0.0
Nothing changed, the crash is still pouring in every hour.
One prior update to that we removed permission: android.permission.ACCESS_BACKGROUND_LOCATION to be compliant with that recent change. However it was a relic and the app has not actually required it for years.
This is seemingly when the crash began, though as far as I'm aware, Firebase SDK doesn't need this permission and hasn't needed it but we're grasping at straws.
Some build vars:
minSdkVersion 19
targetSdkVersion 30
compileSdkVersion 30
buildToolsVersion 32.0.0
Gradle 7.1.2
android.enableJetifier=true
android.enableR8=true
android.enableR8.fullMode=true
android.useAndroidX=true
It feels like a build problem, as our code base changed very little (a single manifest perm line before attempting the Firebase SDK update)...but we're just not having much luck and the variance in not every one encountering it, is peculiar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这可以帮助一个人避免我们所遭受的痛苦。我们的解决方案是将其添加到 proguard:
并将我们的依赖更改为:
我们并不完全清楚为什么这是必要的。
In the event this helps a single person avoid the pain we endured. Our solution was adding this to proguard:
And changing our depend to:
We are not entirely clear on why this became necessary.
我从事 Firebase 安装服务工作。
感谢 Niklas 在 https://issuetracker.google.com/issues/244700433。
正如您在票证中提到的,如果 android proguard 规则未正确加载,则会发生此崩溃。
如果遇到此崩溃,请仔细检查应用的
build.gradle
文件中是否存在proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
。I work on Firebase Installations Service.
Thank you Niklas, for reporting this crash in https://issuetracker.google.com/issues/244700433.
As you mention in the ticket, this crash will happen if the android proguard rules weren't loaded properly.
If one runs into this crash, please double check that
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
is present in app'sbuild.gradle
file.