dpa99c / cordova-plugin-request-location-accuracy

Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog
96 stars 62 forks source link

Compatibility problems between phonegap-plugin-push 2.2.3 and cordova-plugin-request-location-accuracy using Cordova 8 and android@7.1.0 #59

Closed giosgu closed 5 years ago

giosgu commented 5 years ago

I'm submitting a ... (check one with "x"):

Bug report

Regarding this issue, i'm having the same problem with phonegap-plugin-push 2.2.3, and i've been unable to solve it applying the fix that uses plugins cordova-android-firebase-gradle-release and cordova-android-play-services-gradle-release. I'll be grateful if you could take a look at it.

Expected behavior:

Steps to reproduce:

***@*** MINGW64 ~/Documents/lab/compatibilityissue
$ npm install -g cordova
C:\Users\***\AppData\Roaming\npm\cordova -> C:\Users\***\AppData\Roaming\npm\node_modules\cordova\bin\cordova
+ cordova@8.1.2
updated 1 package in 19.428s

$ ionic cordova plugin add phonegap-plugin-push@2.2.3
Adding phonegap-plugin-push to package.json
Saved plugin info for "phonegap-plugin-push" to config.xml

$ ionic cordova plugin add cordova-plugin-request-location-accuracy@2.2.3
> cordova plugin add cordova-plugin-request-location-accuracy@2.2.3 --save
Adding cordova-plugin-request-location-accuracy to package.json
Saved plugin info for "cordova-plugin-request-location-accuracy" to config.xml

$ cordova plugin add cordova-android-play-services-gradle-release  --variable PLAY_SERVICES_VERSION=15.+
Adding cordova-android-play-services-gradle-release to package.json
Saved plugin info for "cordova-android-play-services-gradle-release" to config.xml

$ cordova plugin add cordova-android-firebase-gradle-release  --variable FIREBASE_VERSION=15.+
Adding cordova-android-firebase-gradle-release to package.json
Saved plugin info for "cordova-android-firebase-gradle-release" to config.xml

$ ionic cordova platform add android
> cordova platform add android --save
Using cordova-fetch for cordova-android@~7.1.1
Adding android project...

$ ionic cordova build android
> ionic-app-scripts build --target cordova --platform android
[17:55:26]  ionic-app-scripts 3.2.1 
[17:55:26]  build dev started ...
[17:55:26]  clean started ...
[17:55:26]  clean finished in 4 ms
[17:55:26]  copy started ...
[17:55:26]  deeplinks started ...
[17:55:26]  deeplinks finished in 42 ms
[17:55:26]  transpile started ...
[17:55:38]  transpile finished in 12.10 s
[17:55:38]  preprocess started ...
[17:55:38]  preprocess finished in 1 ms
[17:55:38]  webpack started ...
[17:55:39]  copy finished in 13.08 s
[17:55:45]  webpack finished in 6.71 s
[17:55:45]  sass started ...
[17:55:49]  sass finished in 4.36 s
[17:55:49]  postprocess started ...
[17:55:49]  postprocess finished in 28 ms
[17:55:49]  lint started ...
[17:55:49]  build dev finished in 23.77 s
[17:55:55]  lint finished in 5.95 s
> cordova build android
cordova-android-firebase-gradle-release: Android platform: V7+
cordova-android-firebase-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\app\build.gradle
cordova-android-firebase-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-android-firebase-gradle-release\starter-cordova-android-firebase-gradle-release.gradle
cordova-android-play-services-gradle-release: Android platform: V7+
cordova-android-play-services-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\app\build.gradle
cordova-android-play-services-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-android-play-services-gradle-release\starter-cordova-android-play-services-gradle-release.gradle
Android Studio project detected
cordova-android-firebase-gradle-release: Android platform: V7+
cordova-android-firebase-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\app\build.gradle
cordova-android-firebase-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-android-firebase-gradle-release\starter-cordova-android-firebase-gradle-release.gradle
cordova-android-play-services-gradle-release: Android platform: V7+
cordova-android-play-services-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\app\build.gradle
cordova-android-play-services-gradle-release: Wrote custom version '15.+' to C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-android-play-services-gradle-release\starter-cordova-android-play-services-gradle-release.gradle
ANDROID_HOME=C:\Users\***\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_201
studio
Starting a Gradle Daemon (subsequent builds will be faster)
:wrapper

BUILD SUCCESSFUL in 19s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
+-----------------------------------------------------------------
| cordova-android-firebase-gradle-release: 15.+
+-----------------------------------------------------------------
+-----------------------------------------------------------------
| cordova-android-play-services-gradle-release: 15.+
+-----------------------------------------------------------------
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_80wj3w89zngcrjvr4hunugrka.run(C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\app\build.gradle:152)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-support-google-services\starter-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > All firebase libraries must be either above or below 14.0.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\***\Documents\lab\compatibilityissue\pluginissue\platforms\android\cordova-support-google-services\starter-build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > All firebase libraries must be either above or below 14.0.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Environment information

Android build issue:

If using an [Ionic Native Typescript wrapper]() for this plugin:

// Paste any relevant JS/native console output here



</details><br/><br/>

**Other information:**

<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->

# Feature request
<!--
Feature requests should include as much detail as possible:

- A descriptive title 
- A description of the problem you're trying to solve, including why you think this is a problem
- An overview of the suggested solution
- Use case: why should this be implemented?
- If the feature changes current behavior, reasons why your solution is better
- Relevant links, e.g.
    - Stack Overflow post illustrating a solution
    - Code within a Github repo that illustrates a solution
    - Native API documentation for proposed feature
-->

# Documentation issue
<!-- 
Describe the issue with the documentation or the request for documentation changes.
- Please give reasons why the change is necessary.
- If the change is trivial or you are able to make it, please consider making a Pull Request containing the necessary changes.
-->

<!--
A POLITE REMINDER

- This is free, open-source software. 
- Although the author makes every effort to maintain it, no guarantees are made as to the quality or reliability, and reported issues will be addressed if and when the author has time. 
- Help/support will not be given by the author, so forums (e.g. Ionic) or Stack Overflow should be used. Any issues requesting help/support will be closed immediately.
- If you have urgent need of a bug fix/feature, the author can be engaged for PAID contract work to do so: please contact dave@workingedge.co.uk
- Rude or abusive comments/issues will not be tolerated, nor will opening multiple issues if those previously closed are deemed unsuitable. Any of the above will result in you being BANNED from ALL of my Github repositories.
-->
dpa99c commented 5 years ago

phonegap-plugin-push depends on another plugin - cordova-support-google-services - to pull in the Google Services plugin.

This implicitly includes components of the Play Services library (and maybe Firebase - not sure) so cordova-android-firebase-gradle-release and cordova-android-play-services-gradle-release cannot be used to override the requested versions in the same way they can be used for this plugin.

You need to figure out what versions of the Play Services library (and maybe Firebase) are being included by the version of the Google Services plugin being pulled in by cordova-support-google-services and set the plugin variables for cordova-android-firebase-gradle-release and cordova-android-play-services-gradle-release to align with those. The latter will override this plugin's Play Services default and so align with whatever version the Google Services plugin is requiring.

giosgu commented 5 years ago

Based on your comment, i managed to make the build by adding the cordova-play-services-version-adapter plugin, which applied the following changes: