简体   繁体   中英

Weird issue on Android 4.4 (KitKat) with MotionEvent.obtain

I'm getting the first bug reports of users running Android 4.4, and all of them are about a java.lang.NoSuchFieldError: glMultMatrixxOES because of a MotionEvent.obtain call.

Somewhere in my code I do this:

mCancelEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0f, 0f, 0f, 0f, 0, 0f, 0f, 0, 0);

This works fine on all versions I support (2.2 -> 4.3), but it seems to force close on 4.4, both on custom AOSP ROMs and on the Nexus 5 (with the official vanilla ROM).

Caused by: java.lang.NoSuchFieldError: glMultMatrixxOES
at android.view.InputEvent.<init>(InputEvent.java:46)
at android.view.MotionEvent.<init>(MotionEvent.java:1374)
at android.view.MotionEvent.obtain(MotionEvent.java:1394)
at android.view.MotionEvent.obtain(MotionEvent.java:1525)
at com.my_package.widget.ItemListView.<init>(SourceFile:19)
... 37 more

Any ideas? I've tried debugging this but it has lead me nowhere so far, namely because I see no issues on the emulator.

Could it be due to users using ART instead of Dalvik? I've tried switching the emulator to ART, but I can't get it to boot with it enabled.

I could later verify that it was indeed related to ART.

The latest version of ART, included in Android 4.4.2 if I'm not mistaken, seems to have fixed the problem for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM