spoonconsulting / cordova-plugin-background-upload

Cordova plugin for background upload
Apache License 2.0
51 stars 54 forks source link

Unable to install 2.0.7 #267

Open albertleao opened 1 year ago

albertleao commented 1 year ago

So the latest dev version blows up with the error here: https://github.com/spoonconsulting/cordova-plugin-background-upload/issues/183

And version 2.0.7 doesn't install after running cordova plugin add @spoonconsulting/cordova-plugin-background-upload@2.0.7 --save

Failed to install '@spoonconsulting/cordova-plugin-background-upload': TypeError: Cannot read property 'id' of undefined
    at registerConflict (C:\Users\alber\Documents\Projects\test\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:253:43)
    at C:\Users\alber\Documents\Projects\test\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:278:34
    at Array.forEach (<anonymous>)
    at PlatformMunger._is_conflicting (C:\Users\alber\Documents\Projects\test\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:257:21)
    at PlatformMunger.add_plugin_changes (C:\Users\alber\Documents\Projects\test\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:106:59)
    at C:\Users\alber\Documents\Projects\test\node_modules\cordova-common\src\PluginManager.js:121:33
    at _fulfilled (C:\Users\alber\Documents\Projects\test\node_modules\q\q.js:854:54)
    at C:\Users\alber\Documents\Projects\test\node_modules\q\q.js:883:30
    at Promise.promise.promiseDispatch (C:\Users\alber\Documents\Projects\test\node_modules\q\q.js:816:13)
    at C:\Users\alber\Documents\Projects\test\node_modules\q\q.js:877:14

This is on a brand new cordova project with no other plugins. Issue doesn't happen if i revert android back to 10

zfir commented 1 year ago

Hello @albertleao,

What version of node and npm are you using?

Screenshot 2023-03-27 at 09 53 00

I was able to include it in these version as shown in the above screenshot.

albertleao commented 1 year ago

Node 14.16.1 NPM 6.14.22

Will attempt with your version.

albertleao commented 1 year ago

image

albertleao commented 1 year ago

Also tried on a brand new cordova project and got the same error

zfir commented 1 year ago

Hello @albertleao,

Is it possible to send me your package.json? I am not able to reproduce it on my side.

albertleao commented 1 year ago

issue is also happening on 10.1.1 now.

{
  "name": "app",
  "version": "5.0.0",
  "description": "native applications",
  "main": "www/index.html",
  "scripts": {
    "cordova": "cordova"
  },
  "repository": {
    "type": "git",
    "url": "scrubbed"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "scrubbed"
  },
  "homepage": "scrubbed",
  "dependencies": {
    "@ahovakimyan/cordova-plugin-wkwebviewxhrfix": "^1.0.0",
    "@gedysintraware/cordova-universal-links-plugin": "git+https://github.com/GEDYSIntraWare/cordova-universal-links-plugin.git",
    "@havesource/cordova-plugin-push": "4.0.0-dev.0",
    "@spoonconsulting/cordova-plugin-background-upload": "2.0.7",
    "@spoonconsulting/cordova-plugin-camera": "git+https://github.com/spoonconsulting/cordova-plugin-camera.git",
    "cordova-labs-notification-rebroadcast": "git+https://github.com/apache/cordova-plugins.git#notification-rebroadcast",
    "cordova-plugin-android-support-v4-jar": "^23.2.1",
    "cordova-plugin-androidx": "1.0.2",
    "cordova-plugin-androidx-adapter": "1.1.0",
    "cordova-plugin-file": "6.0.2",
    "cordova-plugin-local-notifications": "^1.0.0",
    "cordova-splash": "github:AlexDisler/cordova-splash",
    "file": "^0.2.2",
    "jetifier": "^2.0.0",
    "phonegap-plugin-multidex": "^1.0.0",
    "plugin": "^0.3.3",
    "properties-parser": "^0.3.1",
    "recursive-readdir": "^2.2.2",
    "rollbar": "^2.3.8"
  },
  "cordova": {
    "plugins": {
      "@havesource/cordova-plugin-push": {
        "ANDROIDX_CORE_VERSION": "1.6.+",
        "FCM_VERSION": "23.+"
      }
    },
    "platforms": []
  },
  "devDependencies": {
    "cordova-android": "^10.1.1",
    "eslint-plugin-vue": "^6.2.2"
  }
}
albertleao commented 1 year ago

When you say it installs for you, is it actually working? Depending on my config, i can get it to install but I haven't gotten it to actually upload anything

albertleao commented 1 year ago

What version of gradle are you using?

zfir commented 1 year ago

Hello @albertleao,

So you are were able to fixed the error Failed to install...? I have not not tested the upload as your error was on the installation process(when adding the plugin).

I have tested by copying all the plugins(in your package.json) in a new project and was not able to reproduce the error.

As for the Gradle version, I am using is 8.0.2. I have some other project that is running this plugin and is using version 7.1.1.

albertleao commented 1 year ago

Are you adding via npm or using cordova plugin add?

Still 0 luck installing and using this plugin. Worked fine a few months ago.

albertleao commented 1 year ago

After tweaking a bunch of settings I managed to get it to install but now running into this issue


E/PluginManager: Uncaught exception from plugin
    android.database.sqlite.SQLiteException: Can't downgrade database from version 4 to 1
        at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:540)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:414)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
        at com.orm.SugarDb.getDB(SugarDb.java:38)
        at com.orm.SugarRecord.getSugarDataBase(SugarRecord.java:35)
        at com.orm.SugarRecord.find(SugarRecord.java:201)
        at com.orm.SugarRecord.listAll(SugarRecord.java:127)
        at com.spoon.backgroundfileupload.UploadEvent.all(UploadEvent.java:41)
        at com.spoon.backgroundfileupload.FileTransferBackground.initManager(FileTransferBackground.java:185)
        at com.spoon.backgroundfileupload.FileTransferBackground.execute(FileTransferBackground.java:129)
        at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
        at org.apache.cordova.PluginManager.exec(PluginManager.java:146)
        at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
        at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:335)
        at android.os.Looper.loopOnce(Looper.java:161)
        at android.os.Looper.loop(Looper.java:288)
        at android.os.HandlerThread.run(HandlerThread.java:67)
zfir commented 1 year ago

Hello @albertleao,

Have you installed another version of background upload before, the latest versions(4.0....)? If you have done that, try to clear data/cache on the device that you are testing.

Another possibility is that another plugin is using the SQLite Database. For that, I will recommend you to install the latest version 4.0.10 as we are already using version 4 for the database. https://github.com/spoonconsulting/cordova-plugin-background-upload/blob/b27c663b7c74c746975155ee35521e0a09da9ff5/src/android/AckDatabase.java#L11