WebView causes app crash when trying to call @JavascriptInterface method on Android 5.1.1
Reported by
as...@dropbox.com,
May 10 2016
|
|||
Issue descriptionSteps to reproduce the problem: 1. Launch an app on Android 5.1.1 that has added a @JavascriptInterface method to a WebView 2. While running, have the Javascript running in the webview try to call that method. 3. When the method is called the app crashes with a native crash in the chromium webview. This only happens in Android 5.1.1 What is the expected behavior? The app should not crash and the Java method should get called by the javascript call as it does on every other version of Android. What went wrong? Hi There, I'm having an issue with Android Webview specifically on Android 5.1.1 when I try to call a @JavascriptInterface method. This only happens under these conditions: - Android 5.1.1 - Release Build Because this is only happening on the release builds I tried removing Proguard completely but I'm still seeing the issue. What else could be happening on the release build that's causing this? This is also not happening on any other version of Android 5.1.1. I've also attached the crash log which includes the native crashes. Crashed report ID: How much crashed? Whole browser Is it a problem with a plugin? No Did this work before? N/A Chrome version: Android WebView Channel: stable OS Version: 5.1.1 Flash Version:
,
May 10 2016
In order to workaround this I removed the Javascript interface on Android 5.1.1 devices and instead post any messages in Javascript to and iFrame. I then check this iFrame with the WebView. This obviously slows performance but I have no other options on Android 5.1.1 devices.
,
May 13 2016
I'm seeing this crash on Android 4.4.4 devices as well. Seems like the JavascriptInterface is simply broken on several Android versions.
,
May 20 2016
,
May 25 2016
can you provide a small repro case?
,
May 25 2016
The fact that it only happens on your release builds shows that it is most likely a proguard issue or some other configuration/app bug on your end. I think you are on the right path investigating proguard. /art (24750): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: java_array == null is it possible you are running into an OOM case? Since I am strongly suspecting an app bug, I am closing the bug as Won't fix. However, will take a look if you provide some apk or code that repro's the problem. |
|||
►
Sign in to add a comment |
|||
Comment 1 by as...@dropbox.com
, May 10 2016Also, just to note I've also added the following to my proguard: -keepattributes JavascriptInterface -keep public class com.dropbox.papercore.api.PaperWebView$JavascriptInterfaceHandler -keep public class * implements com.dropbox.papercore.api.PaperWebView$JavascriptInterfaceHandler -keepclassmembers class com.dropbox.papercore.api.PaperWebView$JavascriptInterfaceHandler { <methods>; } -keepclassmembers class * { @android.webkit.JavascriptInterface <methods>; } It still doesn't work and I'm still seeing the same crash. Regardless, this issue is still only happening on Android 5.1.1 so I'm not sure it's a proguard issue as I've even disabled it completely to see if it would work.