Search code examples
androidcordovacordova-pluginschromium

Cordova Error "WebView: Unknown frame routing id: 1"


So I have a plugin that launches a native app via an Intent in my plugin. However when the native app launches I get a fairly brief error message and I'm not sure how to debug it or where to go.

The error message says "com.xxx.mine.IMAGE_CAPTURE has stopped working"

and the logcat shows E/chromium: [ERROR:gin_java_bridge_message_filter.cc(106)] WebView: Unknown frame routing id: 1.

Here is some code for reference

JAVA CODE

public class MyPlugin extends CordovaPlugin {

    public static final String TAG = "MyPlugin";
    public CordovaInterface mCordova;    

    public MyPlugin() {}    

    public void initialize(CordovaInterface cordova, CordovaWebView webView) {
        super.initialize(cordova, webView);
        mCordova = cordova;         
    }       

    public boolean execute(final String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        startCameraActivity();

        return true;
    }

    private void startCameraActivity() {
        Intent i = new Intent("com.xxx.mine.IMAGE_CAPTURE");

        i.putExtra("USER_EXTRA", "test_user");
        ....            

        mCordova.startActivityForResult(this, i, 567);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (data != null && requestCode == 567) {
            Log.e("RESULT", "SUCCESSFUL");
        } else {
            Log.e("RESULT", "ERROR");
        }

        super.onActivityResult(requestCode, resultCode, data);
    }
}

If you would like to see any of the html or javascript code let me know but I don't think that's where the problem is. Honestly though I have no idea what the problem is because when I google the error message I get 0 helpful results. My instinct tells me the webview is having a hard time inflating the app's views, but thats about all I got. I will accept any help, either a way to debug this error message or if any of you have seen this error message before and how you solved it. Thanks!


Solution

  • I was able to debug this by creating a native android app in Android studio and integrating the plugin code. Turned out some JSON I was sending as an Intent Extra was expecting a JSONObject but was getting a JSONArray. If anyone else runs into this problem perhaps this will be your solution. If not try and do what I did. Create an app in Android Studio and debug from there.