katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

Add support for Android P #367

Open sharppaul opened 6 years ago

sharppaul commented 6 years ago

Even though I didn't try to build specifically for Android P, I got this error while installing the plugin.

$ phonegap cordova plugin add cordova-plugin-background-mode
Installing "cordova-plugin-background-mode" for android

Failed to install 'cordova-plugin-background-mode':TypeError: Invalid Version: android-P
    at new SemVer (/usr/lib/node_modules/phonegap/node_modules/cordova-lib/node_modules/semver/semver.js:295:11)
    at Range.test (/usr/lib/node_modules/phonegap/node_modules/cordova-lib/node_modules/semver/semver.js:1049:15)
    at Function.satisfies (/usr/lib/node_modules/phonegap/node_modules/cordova-lib/node_modules/semver/semver.js:1098:16)
    at checkEngines (/usr/lib/node_modules/phonegap/node_modules/cordova-lib/src/plugman/install.js:144:21)
    at /usr/lib/node_modules/phonegap/node_modules/cordova-lib/src/plugman/install.js:343:16
    at _fulfilled (/usr/lib/node_modules/phonegap/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/lib/node_modules/phonegap/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/phonegap/node_modules/q/q.js:749:13)
    at /usr/lib/node_modules/phonegap/node_modules/q/q.js:557:44
    at flush (/usr/lib/node_modules/phonegap/node_modules/q/q.js:108:17)

Error: Invalid Version: android-P
PTthe13 commented 6 years ago

Was just about to write the exact same thing.

sharppaul commented 6 years ago

In the mean time, I managed to get it working by removing the Android P preview folder from my /android_sdk_tools/platforms folder. I installed the SDK manually on Linux, no idea what its default location is when installed with Android Studio. However, chances are that it'll be added back when you update your SDK.

gbrits commented 6 years ago

Yep, removed the Android-P Preview from my Android Studio and it fixed the problem for me as well. Thanks @sharppaul.

bedezub commented 6 years ago

@sharppaul That solve my problem too!

newtonmunene99 commented 6 years ago

@sharppaul Thank you. After removing Android-P preview from Android Studio It worked

juandl commented 6 years ago

please if have obtained your solution close the issue, thank you!

sharppaul commented 6 years ago

@juandi I'm not closing this issue until Android P is actively supported. You shouldn't accept workarounds as a solve.

juandl commented 6 years ago

@sharppaul That's why I said, if you got the solution, close the issue, but if not, leave it open, take it easy! (^-^),

Also please explain your problem better and place the debug of your project, to have more details and be able to do tests, also remember that the npm repository is not updated, please use the command cordova plugin add https://github.com/katzer/cordova-plugin-background-mode