cordova-plugin-code-push icon indicating copy to clipboard operation
cordova-plugin-code-push copied to clipboard

Codepush not working Android plugin 1.12.5

Open BbFGE opened this issue 5 years ago • 4 comments

We have a couple of Cordova/Phonegap apps (Android and IOS) which use cordova-plugin-code-push to distribute new content. The apps were built using PhoneGap Build.

Currently the live apps use cordova-plugin-code-push 1.11.7 and index.html has this line

<meta content="default-src https://codepush.azurewebsites.net 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; img-src * data: blob: android-webview-video-poster:; style-src 'self' 'unsafe-inline'; media-src *" http-equiv="Content-Security-Policy"/>

and i use the app center CLI to release updates eg appcenter codepush release-cordova -a _owner/appname_ -d Production

and this works fine - the new content is picked up by the apps and the Appcenter shows the new release and the number of devices with this release.

However, I know there have been issues with https://codepush.azurewebsites.net in the past, and we need to repoint codepush to https://codepush.appcenter.ms

So I uninstalled cordova-plugin-code-push and reinstalled to the latest version.

This also required removing and reinstalling some of the plugins for file handlig as it gave errors about versino numbers.

I also updated index.html

<meta content="default-src https://codepush.appcenter.ms 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; img-src * data: blob: android-webview-video-poster:; style-src 'self' 'unsafe-inline'; media-src *" http-equiv="Content-Security-Policy"/>

However, for the Android app, I had issues. I created a brand new test app to make sure it wasn't somethin inherited from the live app, but the same thing happened.

Having created a release using the appcenter CLI and installed the app, on running it the first time, it downloads the release. However, Appcenter Distribute/CodePush still shows 0 active devices (normally this is upfdated once the release is installed on each device).

I then created a new release, again using Appcenter re-ran the app.

This time it did not pick up the new release, but stayed at the first one.

Appcenter showed both Rollbacks and Active Devices as '-' (not even 0)

I used Chrome to debug the app and saw this error message

DevTools failed to load SourceMap: Could not load content for file:///android_asset/www/plugins/code-push/script/acquisition-sdk.js.map: System error: net::ERR_FILE_NOT_FOUND So it looks like the first release did not download something or if it did, the app can't find it.

Is it a problem with the file plugins or codepush.

(Oddly, I have created a Cordova IOS app - this time using XCode with cordova-plugin-code-push 1.12.2 and thsis works fine).

Has anyone encountered any issues with this, and better still, anyone have a solution?

Here is information about the problem Android app:

C:\Development\Phonegap\AndroidTest>phonegap plugin list
code-push 3.0.1 "CodePushAcquisition"
cordova-plugin-advanced-http 3.0.0 "Advanced HTTP plugin"
cordova-plugin-appcenter-analytics 0.5.1 "App Center Analytics for Cordova"
cordova-plugin-appcenter-shared 0.5.1 "App Center shared code for Cordova"
cordova-plugin-code-push 1.12.5 "CodePush"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"

(not sure if I need code-push 3.0.1 but 2.0.4 is in th elive app and it works)

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.AndroidTest" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>Test Android CodePush</name>
    <description>
        Test application
    </description>
    <author email="[email protected]" href="http://phonegap.com">
         TestAndroid CodePush
    </author>
    <content src="index.html" />
    <access origin="*" />
    <access launch-external="true" origin="tel:*" />
    <platform name="android">
        <preference name="APP_SECRET" value="_xxx_" />
        <preference name="CodePushDeploymentKey" value="_xxx_" />
        <preference name="android-build-tool" value="gradle" />
        <preference name="android-minSdkVersion" value="16" />
        <preference name="AllowInlineMediaPlayback" value="true" />
        <preference name="android-targetSdkVersion" value="28" />
        <preference name="SplashMaintainAspectRatio" value="true" />
        <preference name="SplashShowOnlyFirstTime" value="true" />
        <icon density="ldpi" src="res/icon/android/ldpi.png" />
        <icon density="mdpi" src="res/icon/android/mdpi.png" />
        <icon density="hdpi" src="res/icon/android/hdpi.png" />
        <icon density="xhdpi" src="res/icon/android/xhdpi.png" />
        <icon density="xxhdpi" src="res/icon/android/xxhdpi.png" />
        <icon density="xxxhdpi" src="res/icon/android/xxxhdpi.png" />
        <splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
        <splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
        <splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
        <splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
        <splash density="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png" />
        <splash density="port-xxxhdpi" src="res/screen/android/splash-port-xxxhdpi.png" />
        <splash density="land-ldpi" src="res/screen/android/splash-land-ldpi.png" />
        <splash density="land-mdpi" src="res/screen/android/splash-land-mdpi.png" />
        <splash density="land-hdpi" src="res/screen/android/splash-land-hdpi.png" />
        <splash density="land-xhdpi" src="res/screen/android/splash-land-xhdpi.png" />
        <splash density="land-xxhdpi" src="res/screen/android/splash-land-xxhdpi.png" />
        <splash density="land-xxxhdpi" src="res/screen/android/splash-land-xxxhdpi.png" />
    </platform>
    <preference name="phonegap-version" value="cli-8.0.0" />
    <allow-intent href="mailto:*" />
    <allow-intent href="tel:*" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <plugin name="cordova-plugin-appcenter-analytics" spec="~0.5.1" />
    <plugin name="cordova-plugin-code-push" spec="~1.12.5" />
    <plugin name="cordova-plugin-file" spec="~6.0.2" />
    <plugin name="cordova-plugin-file-transfer" spec="~1.7.1" />
    <plugin name="cordova-plugin-zip" spec="~3.1.0" />
    <plugin name="cordova-plugin-appcenter-shared" spec="^0.5.1" />
    <plugin name="cordova-plugin-whitelist" spec="~1.3.4" />
</widget>

BbFGE avatar Aug 01 '20 09:08 BbFGE

Hi @BbFGE , Thanks for reporting!

Could you please check your app with latest cordova-plugin-code-push version 1.13.0? Please let me know if it was successful or you still have this issue?

alexandergoncharov-zz avatar Aug 21 '20 13:08 alexandergoncharov-zz

I have tried cordova plugin rm cordova-plugin-code-push then cordova plugin add [email protected] but the installed version is still cordova-plugin-code-push 1.12.5 "CodePush"

kelokchan avatar Aug 25 '20 06:08 kelokchan

@kelokchan it is interesting. Could you please also reinstall the platform?

alexandergoncharov-zz avatar Aug 27 '20 11:08 alexandergoncharov-zz

@kelokchan it is interesting. Could you please also reinstall the platform?

I have done that. The installed version is still 1.12.5

My ionic info

Ionic:

   Ionic CLI          : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.10

Cordova:

   Cordova CLI       : 8.1.2 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 1.2.1, (and 18 other plugins)

kelokchan avatar Aug 28 '20 03:08 kelokchan