i've been struggling long now. hope can me. here situation:
in our android app, route xmlhttprequests our webview via java/android can add oauth2 token , track requests. worked fine until android 5 got released.
starting android 5, following exception being raised whenever webview tries interact exposed object in javascript:
java.lang.classnotfoundexception: didn't find class "com/company/android/androidxmlhttprequest$ajaxrequest" on path: dexpathlist[[zip file "/system/app/webview/webview.apk"],nativelibrarydirectories=[/system/app/webview/lib/x86_64, /vendor/lib64, /system/lib64]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:511) @ java.lang.classloader.loadclass(classloader.java:469) @ com.android.org.chromium.base.systemmessagehandler.nativedorunlooponce(native method) @ com.android.org.chromium.base.systemmessagehandler.handlemessage(systemmessagehandler.java:53) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.os.handlerthread.run(handlerthread.java:61) suppressed: java.lang.classnotfoundexception: invalid name: com/company/android/androidxmlhttprequest$ajaxrequest @ java.lang.class.classforname(native method) @ java.lang.bootclassloader.findclass(classloader.java:781) @ java.lang.bootclassloader.loadclass(classloader.java:841) @ java.lang.classloader.loadclass(classloader.java:504) ... 6 more results on different configurations:
- this code works fine on physical , virtual devices running android < 5.
- this code breaks on physical devices running android 5 , 5.1
- this code works fine on virtual device running android 5.0
- this code breaks on virtual devices running android 5.1
- there no difference between running debug or production build
some info code: * webviewfragment gets initiated in mainactivity.oncreate. * webviewfragment.oncreateview creates object exposed webview * javascript interface gets added in webviewclient.onpagefinished * class exposed public * methods of class exposed public , have @javascriptinterface annotation
starting lollipop, webview has been decoupled android can upgraded via play store. shows error:
dexpathlist[[zip file "/system/app/webview/webview.apk"],nativelibrarydirectories=[/system/app/webview/lib/x86_64, /vendor/lib64, /system/lib64]] i looked @ release notes discover if have different regarding webview , addjavascriptinterface can't seem find anything.
anyone has ideas reason fails?
sorry that, there bug in webview: http://crbug.com/491800
the bug has been introduced in android 5.1, original 5.0 works fine (the emulator). on physical lollipop devices play store, webview gets updated later version (43), still broken. fix came out webview version 44, think rolling out now.
however, there workaround. in injected method accepts instance of ajaxrequest, need replace argument type object, , convert ajaxrequest later in function (see this comment example). way, webview stop trying class can't access @ point.
Comments
Post a Comment