Я получаю странный тип Crash в приложении, захваченном во время Crash Analytics, даже если я не использовал код для устройств Bluetooth и не использовал эти строки isBluetoothA2dpOn () . Кроме того, я не смог отследить код, с которого он был запущен журналами трассировки, захваченными Crash Analytics . Если кто-то сталкивался с той же проблемой, то предложите лучший ответ для этого.
на android.view.View.dispatchTouchEvent (View.java:10779)
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.media.AudioManager.isBluetoothA2dpOn()' on a null object reference
at android.inputmethodservice.KeyboardView.sendAccessibilityEventForUnicodeCharacter(KeyboardView.java:998)
at android.inputmethodservice.KeyboardView.showPreview(KeyboardView.java:883)
at android.inputmethodservice.KeyboardView.onModifiedTouchEvent(KeyboardView.java:1301)
at android.inputmethodservice.KeyboardView.onTouchEvent(KeyboardView.java:1223)
at android.view.View.dispatchTouchEvent(View.java:10779)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2864)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2491)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:609)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890)
at android.app.Activity.dispatchTouchEvent(Activity.java:3240)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source:68)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source:68)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:571)
at android.view.View.dispatchPointerEvent(View.java:11008)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5155)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5007)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4585)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4551)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4684)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4559)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4741)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4585)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4551)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4559)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4532)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7024)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6985)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7202)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Отредактированная отправка TouchEvent
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (touchListener != null) {
if (!haltRegistration) {
touchListener.onTouchEvent();
} else {
haltRegistration = false;
}
} else {
Log.d(TAG, "listener was null...");
}
}
}, 300);
}
return super.dispatchTouchEvent(ev);
}