简体   繁体   English

用户从 Google Play 下载时应用崩溃

[英]App crash with user downloaded from Google Play

I have an app on Google Play with more than 45k download.我在 Google Play 上有一个下载量超过 45k 的应用。 The app has a bug with 3% users but cannot reproduce in debug or release mode.该应用程序存在 3% 用户的错误,但无法在调试或发布模式下重现。 Very hard to reproduce.很难复制。 Anyone has experience with this bug please help me.任何有此错误经验的人请帮助我。

Crash log崩溃日志

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.sendAccessibilityEvent(int)' on a null object reference at android.view.ViewRootImpl$AccessibilityInteractionConnectionManager.onAccessibilityStateChanged(ViewRootImpl.java:7712) at android.view.accessibility.AccessibilityManager.lambda$-android_view_accessibility_AccessibilityManager_36305(AccessibilityManager.java:1007) at android.view.accessibility.-$Lambda$T3m_l9_RA18vCOcakSWp1lZCy5g$1.$m$0(Unknown Source:6) at android.view.accessibility.-$Lambda$T3m_l9_RA18vCOcakSWp1lZCy5g$1.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:172) at android.app.ActivityThread.main(ActivityThread.java:6637) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteIni致命异常:java.lang.NullPointerException:尝试在 android.view.ViewRootImpl$AccessibilityInteractionConnectionManager.onAccessibilityStateChanged(ViewRootImpl.java:7712) 处的空对象引用上调用虚拟方法“void android.view.View.sendAccessibilityEvent(int)” android.view.accessibility.AccessibilityManager.lambda$-android_view_accessibility_AccessibilityManager_36305(AccessibilityManager.java:1007) at android.view.accessibility.-$Lambda$T3m_l9_RA18vCOcakSWp1lZCy5g$1.$m$0(Unknown Source.view.accessibility) $Lambda$T3m_l9_RA18vCOcakSWp1lZCy5g$1.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop( Looper.java:172) at android.app.ActivityThread.main(ActivityThread.java:6637) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240) 在 com.android.internal.os.ZygoteInit.main(ZygoteIni t.java:767) t.java:767)

One great thing about Android is that it is open source so you can work these things out for yourself. Android 的一大优点是它是开源的,因此您可以自己解决这些问题。

First look at the the error message:先看错误信息:

Attempt to invoke virtual method 'void android.view.View.sendAccessibilityEvent(int)' on a null object reference尝试在空对象引用上调用虚拟方法“void android.view.View.sendAccessibilityEvent(int)”

This means there is some code somewhere doing foo.sendAccessibilityEvent(anInt) but foo is null (ie AKA a null object reference).这意味着在某处有一些代码在执行foo.sendAccessibilityEvent(anInt)但 foo 为null (即,也就是空对象引用)。 It even tells you where this code is:它甚至会告诉你这段代码在哪里:

android.view.ViewRootImpl$AccessibilityInteractionConnectionManager.onAccessibilityStateChanged(ViewRootImpl.java:7712)

The next thing you need to do is look for the source code.您需要做的下一件事是查找源代码。 You could do this in Android Studio or the web.您可以在 Android Studio 或 Web 中执行此操作。 I'll Google for "AccessibilityInteractionConnectionManager android source code"我会谷歌“AccessibilityInteractionConnectionManager android 源代码”

The top link takes me to the code .顶部链接将我带到代码 I search in my web browser for the method name "onAccessibilityStateChanged()" in case the user has an old phone and the line number has changed.我在我的 Web 浏览器中搜索方法名称“onAccessibilityStateChanged()”,以防用户使用旧电话并且线路号已更改。

The code looks like this:代码如下所示:

 public void onAccessibilityStateChanged(boolean enabled) { if (enabled) { ensureConnection(); if (mAttachInfo.mHasWindowFocus) { mView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); View focusedView = mView.findFocus(); if (focusedView != null && focusedView != mView) { focusedView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); }

As you can see, focusedView is checked for null, but mView isn't.如您所见, focusedView被检查为 null,但mView不是。

If we search for mview = in that file we see that it can happen in 3 ways:如果我们在该文件中搜索mview = ,我们会看到它可以通过 3 种方式发生:

  • if the accessibility state changes before the object is initialized with a view.如果在使用视图初始化对象之前可访问性状态发生变化。 This looks possible unfortunately.不幸的是,这看起来可能。 I can't see any reason in the code while it wouldn't happen.我在代码中看不到任何原因,而它不会发生。
  • in line 607, if a RemoteException occurs when the window is added to the display.在第 607 行,如果在将窗口添加到显示时发生 RemoteException。 If this happened you could see an "Adding window failed" RuntimeEception in your crashes.如果发生这种情况,您可能会在崩溃中看到“添加窗口失败”RuntimeEception。 This is probably unlikely这可能不太可能
  • in line 3186, mView is set to null if dispatchDetachedFromWindow.在第 3186 行中,如果 dispatchDetachedFromWindow,则mView设置为 null。

Anyway, it seems odd that 3% of your users are using AccessibilityManager and changing the state.无论如何,3% 的用户正在使用 AccessibilityManager 并更改状态似乎很奇怪。 Is it possible your app is using Accessibility to do stuff it shouldn't, and this is causing the crash.您的应用程序是否可能正在使用辅助功能来做它不应该做的事情,这会导致崩溃。 It might be that users on slower phones haven't initialized the view correctly before accessibility starts acting.在可访问性开始起作用之前,速度较慢的手机上的用户可能没有正确初始化视图。 You could try taking your uses of the Accessibility API out to see if that improves things.您可以尝试使用 Accessibility API,看看这是否有所改善。

Another possibility is that it isn't your app using accessibility, but another app trying manipulate your app.另一种可能性是它不是您的应用程序使用辅助功能,而是另一个尝试操纵您的应用程序的应用程序。 Is your app the kind of app where users might use accessibility services to cheat, eg a game which rewards clicking really quickly?您的应用程序是那种用户可能会使用无障碍服务作弊的应用程序,例如一款奖励点击速度非常快的游戏吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Google Play下载后,应用首次启动时会崩溃(ExceptionInInitializerError) - App crash at first start after downloaded from Google play (ExceptionInInitializerError) cordova检测应用程序是否从Google Play下载 - cordova detect if app was downloaded from Google Play 如何知道该应用是从Google Play下载的? - How to know the app is downloaded from Google Play? 从 Google Play 下载时应用程序崩溃 - App crashes when downloaded from Google Play 即使不是使用Play应用下载的,Android也会将崩溃/冻结报告发送到Google的Play商店吗? - Does Android send crash/freeze reports to Google's Play Store even if the app was not downloaded using the Play app? 从Google Play下载应用后,如何自动提示用户进行操作? - How to automatically prompt the user for an action after app is downloaded from google play? 如果从Google Play下载应用,则android facebook登录将停止工作 - android facebook login stops working if app is downloaded from google play 如何过滤要从Google Play下载到特定设备的Android应用? - how to filter android app to be downloaded from google play to specific device? 从Google Play商店下载应用时,getInstallerPackageName()是否可能为null? - Is it possible that getInstallerPackageName() is null when app downloaded from Google Play Store? 从Google Play下载应用程序时存储客户数据 - Store Customer data when app is downloaded from google play
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM