4
votes

I am developing (and near to the release) of a Cordova App for iOS and Android.

I am trying to use cordova-plugin-ionic-webview in order to use the latest WebView engines.

I am able to use this plugin on iOS but on Android the App crashes on launch.

MY CONFIG.XML:

    <allow-navigation href="cordovaios://*" />
    <allow-navigation href="cordovaandroid://*" />
    <plugin name="cordova-plugin-ionic-webview" spec="^4.0.0">
        <variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
    </plugin>
    <preference name="Hostname" value="my-backend-url-to-avoid-CORS.com" />
    <preference name="iosScheme" value="cordovaios" />
    <preference name="Scheme" value="cordovaandroid" />
    <preference name="ScrollEnabled" value="true" />
    <preference name="MixedContentMode" value="0" />
    <preference name="AllowBackForwardNavigationGestures" value="true" />
    <preference name="Allow3DTouchLinkPreview" value="false" />
    <preference name="WKSuspendInBackground" value="false" />
    <preference name="KeyboardAppearanceDark" value="false" />

LOGS:

5726-5770/mycertificate.enterprise D/SERVER: Handling local request: cordovaandroid://my-backend-url-to-avoid-CORS.com/static/js/10.601e7973.chunk.js

5726-5773/mycertificate.enterprise E/chromium: [ERROR:render_process_host_impl.cc(4070)] Terminating render process for bad Mojo message: Received bad user message: Origin is invalid

5726-5773/mycertificate.enterprise E/chromium: [ERROR:bad_message.cc(23)] Terminating renderer for bad IPC message, reason 123

NOTE:

This config works fine on iOS. On Android I can't use this plugin due to this Hostname/Origin issue.

2
Similar issue here (though in our case it doesn't crash): when we set the Scheme, the Hostname is ignored on Android. We use cordova-plugin-ionic-webview v4.0.1 and cordova-android v8.0.0 - rbarriuso

2 Answers

2
votes

That custom scheme does not appear to be supported (just try to find something alike that in the source code). It is also beyond my understanding, for what one even would even need to register a custom protocol handler, while never leaving that WebView? The usual purpose is: to open another application.

<preference name="Scheme" value="https" />
<allow-navigation href="https://my-backend-url-to-avoid-CORS.com/*"/>
0
votes

Unfortunately there is a lot of mismatching between the Cordova Android Platform version and plugins versions, which lead to some waste of time for nothing. Said so, for similar problemas I had like this I simply fixed them downgrading the version of Cordova or Android or the Plugin (or use the same version of android the plugin is using in their code example).