microsoft / cordova-plugin-code-push

Cordova plugin for CodePush
http://appcenter.ms
Other
644 stars 335 forks source link

Support for cordova-android>=10.0.0 WebViewAssetLoader default #684

Open torte opened 3 years ago

torte commented 3 years ago

Description

Recently updated to cordova-android 10.0.1 and one of the breaking changes in the major release was the usage of WebViewAssetLoader in favor of loading assets from file:// (https://github.com/apache/cordova-android/pull/1137, read more at https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html). This change unfortunately does not work for cordova-plugin-code-push and (based on the console output) the code-push package never installs correcty and an update is never received on the mobile app. Only when adding the fallback <preference name="AndroidInsecureFileModeEnabled" value="true" />,reverting to the previous default setup of cordova-android, to the config.xml this started working again. While this works for now, this seems to be considered insecure in the long-term.

Console output from connected Chrome dev tools:

Screen Shot 2021-08-06 at 3 04 31 pm

codePushUtil.js:41 [CodePush] Preinstall failure. Could not get the package start page
codePushUtil.js:41 [CodePush]  An error has occurred while installing the package. Could not get the package start page. StackTrace: Error: An error has occurred while installing the package. Could not get the package start page
    at preInstallFailure (https://localhost/plugins/cordova-plugin-code-push/bin/www/localPackage.js:255:41)
    at Object.callbackFromNative (https://localhost/cordova.js:297:52)
    at processMessage (https://localhost/cordova.js:1134:17)
    at processMessages (https://localhost/cordova.js:1157:9)

Excepted behavior

Code push update (sync) should work without issues with latest cordova-android (>=10).

Reproduction

1) Install latest cordova-android platform (currently 10.0.1 in a code-push enabled project 2) Try to push a new update for your code via code-push to the application (without adding <preference name="AndroidInsecureFileModeEnabled" value="true" /> to the project's config.xml file.

Additional Information

Release build only.

Only tried on a physical device and only experienced it there.

Thank you very much.

veneliniliev commented 3 years ago

I have the same problem!