kolbasa/cordova-plugin-apkupdater

Cannot read properties of undefined (reading 'getInstalledVersion')

Closed this issue · 7 comments

Hello! I install this package with Ionic 5 and i has an issue.

image

Can u help me?

Sure, that's what I'm here for.

Can you give me the output of ionic info. That would be helpful.

Ionic:
Ionic CLI : 6.19.1 ([...]\Roaming\npm\node_modules@ionic\cli)
Utility:

cordova-res : not installed globally
native-run : 1.6.0

System:

Android SDK Tools : 26.1.1 ([..]\AppData\Local\Android\Sdk)
NodeJS : v16.15.0 (D:\Program Files\nodejs\node.exe)
npm : 8.5.5
OS : Windows 10

Only i get this informations

You need to run the command (ionic info) in your ionic project folder.

Ohh ye, when i resize cmd window some line is get cleared, full response:

Ionic:

   Ionic CLI                     : 6.19.1 (C:\Users\bankn\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.1.7
   @angular-devkit/build-angular : 13.2.6
   @angular-devkit/schematics    : 13.2.6
   @angular/cli                  : 13.2.6
   @ionic/angular-toolkit        : 6.1.0

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed globally
   native-run  : 1.6.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\bankn\AppData\Local\Android\Sdk)
   NodeJS            : v16.15.0 (D:\Program Files\nodejs\node.exe)
   npm               : 8.5.5
   OS                : Windows 10

So for Ionic + Cordova, installing the plugin with ionic cordova plugin add cordova-plugin-apkupdater should be enough.

I need to update the readme. The cordova-androidx-build is actually no longer needed if you use the latest cordova-android platform.

Here is a complete example with an empty project:

# Create empty project directory
ionic start app blank --type=angular --cordova --no-interactive

# Navigate to new project directory
cd app

# Install the ApkUpdater Plugin
ionic cordova plugin add cordova-plugin-apkupdater

# Add Android Platform
ionic cordova platform add android

# Run on device/emulator
ionic cordova run android

Once the app is launched then open via Chrome chrome://inspect/#devices and inspect the app.
This is the easiest way to check if the plugin was installed correctly.
Simply enter ApkUpdater in the console. If everything went smoothly, all available functions should now be listed.

image

I create a new empty project with ur instructions, but the problem still exist.
image

I push my code the public repository, can u check then?

https://github.com/noelbank00/ionic-apk-updater

Has an ionic-info.txt with the ionic info output for more information.

The project from the public repository is fine. For me the plugin is installed correctly.

git clone https://github.com/noelbank00/ionic-apk-updater
cd ionic-apk-updater
ionic cordova platform add android
ionic cordova run android

Maybe it has something to do with the live reloading ([webpack-dev-server] Live Reloading enabled.).
That's what it looks like when I launch your app.

image