kolbasa/cordova-plugin-apkupdater

Got an "Invalid page file" error with capacitor project

Closed this issue ยท 4 comments

Hi,
I tried download and update with an app-debug.apk file (same file installed on the device), and got an "Invalid package file." error/
Could you please help to find the source of issue ?

Thanks

vendor.js:91997 ERROR Error: Uncaught (in promise): Object: {"message":"Invalid package file: app-debug.apk (size=255)","stack":"de.kolbasa.apkupdater.exceptions.InvalidPackageException\n at de.kolbasa.apkupdater.tools.AppData.getPackageInfo(AppData.java:32)\n at de.kolbasa.apkupdater.update.UpdateManager.getApkInfo(UpdateManager.java:116)\n at de.kolbasa.apkupdater.update.UpdateManager.getUpdate(UpdateManager.java:123)\n at de.kolbasa.apkupdater.update.UpdateManager.download(UpdateManager.java:136)\n at de.kolbasa.apkupdater.ApkUpdater.download(ApkUpdater.java:85)\n at de.kolbasa.apkupdater.ApkUpdater.lambda$execute$3$de-kolbasa-apkupdater-ApkUpdater(ApkUpdater.java:228)\n at de.kolbasa.apkupdater.ApkUpdater$$ExternalSyntheticLambda5.run(D8$$SyntheticClass)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)\n at java.lang.Thread.run(Thread.java:761)\n"} de.kolbasa.apkupdater.exceptions.InvalidPackageException at de.kolbasa.apkupdater.tools.AppData.getPackageInfo(AppData.java:32) at de.kolbasa.apkupdater.update.UpdateManager.getApkInfo(UpdateManager.java:116) at de.kolbasa.apkupdater.update.UpdateManager.getUpdate(UpdateManager.java:123) at de.kolbasa.apkupdater.update.UpdateManager.download(UpdateManager.java:136) at de.kolbasa.apkupdater.ApkUpdater.download(ApkUpdater.java:85) at de.kolbasa.apkupdater.ApkUpdater.lambda$execute$3$de-kolbasa-apkupdater-ApkUpdater(ApkUpdater.java:228) at de.kolbasa.apkupdater.ApkUpdater$$ExternalSyntheticLambda5.run(D8$$SyntheticClass) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) at resolvePromise (http://localhost/polyfills.js:1643:21) at http://localhost/polyfills.js:1538:11 at http://localhost/polyfills.js:1555:27 at asyncGeneratorStep (http://localhost/vendor.js:143394:5) at _throw (http://localhost/vendor.js:143417:9) at _ZoneDelegate.invoke (http://localhost/polyfills.js:570:160) at Object.onInvoke (http://localhost/vendor.js:115285:25) at _ZoneDelegate.invoke (http://localhost/polyfills.js:570:48) at Zone.run (http://localhost/polyfills.js:296:37) at http://localhost/polyfills.js:1716:28

The error message says that the package info of the apk file could not be read.

You can also see in the brackets that the file size is only 255 bytes.
I suspect that either the apk is corrupted or the download of this apk is not completed correctly.

What does the URL of the update apk look like? Can you download the apk manually?

Yes, I tried download it manually and installed on my device successfully.
Here is the URL : app-debug.apk

This is not a direct link to your apk.
Your link redirects to another URL. The plugin has no logic to detect redirects.

Here is the direct link:
https://www.betalife.be/waimai/apk/app-debug.apk

Well, you just saved my day ๐Ÿ˜„ ๐Ÿ‘ ๐Ÿš€
Thanks for your help.

Best