[英]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 种方式发生:
mView
is set to null if 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.