New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error installing plugin #11
Comments
I can see two potential issues: Firstly (this is the most likely cause), you are including Android and Cordova now use Gradle for the build process. Gradle is able to dynamically merge dependencies, leading to less problems with dependency clashes. This plugin uses the Gradle method to include the Google Play Services Location library. Unless you have a good reason to include Secondly, you are including the API 22 version of
I recommend building and running the example project to confirm that your build environment is setup correctly to make use of this plugin. |
Interesting. Yes, I did add cordova-plugin-googleplayservices - the link you provided shows they are now on r26. I have not used the gradle method as thus far all plugins required for my app have been successful via the standard Installed platforms are: android 5.1.1. Question, concerning iOS, the above plugin is for Android only, but how will the plugins react on iOS...will it default back to the cordova.plugins.diagnostic.switchToLocationSettings(); and direct the user to their setting screen? |
Cordova/Phonegap has been using Gradle by default since v4.0.0 (see here). It is up to the plugin author to make use of this feature - you as a plugin user just add the plugin in the standard way and Cordova will take care of the Gradle dependency resolution. As far as iOS is concerned, there is no equivalent functionality that this plugin can make use of, so you'll need some conditional platform-specific behaviour to handle this. Either you can use
Or make use of merges:
|
thanks. I will look into this. However, I copied my whole project into a new directory and then updated the platform and all the SDKs (via Android Studio), I also added support for Adroid v4 and now I am getting build errors (mostly related to v4). The original build directory is still working fine. I won't mess with the original until I know the copied app is building cleanly. /myOrigApp - works fine after all SDKs updated. I 'think' I fixed the first build error: Error 1: by adding to the platform\adroid\build.gradle file:
but am now getting Error 2.
Still researching this one, but thinking it has to do with extra v4 build files or need to delete the v4 folders because gradle is installing them even though not defined in the gralde (that I can see). |
This is almost certainly being caused by multiple instances of the Android v4 support library being included. Looking at the plugins you have installed, Although you have specified Otherwise, it's likely another of your included plugins is either specifying the Android v4 support library as a Gradle dependency or including it directly as a JAR file (like the Facebook plugin). The Facebook plugin really needs to be updated to use Gradle as the use of this JAR file will cause collisions with any other plugins making use of the Android v4 support library - it seems other people are experiencing similar issues see here. Here are a few things you can try:
Edit plugins/com.phonegap.plugins.facebookConnect and replace the line:
with
Remove and re-add the platform:
Personally, I would choose the last option, but I'd also consider forking the Facebook plugin Github repo and apply these changes to my fork, then installing my forked plugin to my local project to avoid losing these local changes if your
|
dpa99c - thank you. You are quite thorough and I can't tell you how much I appreciate that. I will apply everything you advised above and get back with the results. I will step through them until success and update with what the exact combo for success was. The new copied build also has updated plugins, not using the diagnostic-api-22 anymore. br.com.dtmtec.plugins.carrier 1.0.0 "Carrier" The only remaining plugin is google-play-services. But there are like 3 or 4 versions out there and I am not certain which one I should be installing. |
The first "from here" did not work. the facebook plugin def required the v4.jar. However, the 2nd 'from here' DID work. After I removed and readd the platform android though the previous build-extras.gradle file was wiped out....thus the 2nd solution worked completely on its own: Edit plugins/com.phonegap.plugins.facebookConnect and replace the line:
It compiled and thus far everything looks to be working cleanly. Which makes me very excited, because now my app is fully compatible from anything Android 4.0 and forward. To this point I have not added cordova-plugin-request-location-accuracy. I needed to get everything working with v4 and all my previous plugins. I just now added cordova-plugin-request-location-accuracy and the build worked. During the build I see: :prepareComFacebookAndroidFacebookAndroidSdk3230Library UP-TO-DATE So it looks like the new gradle process is taking everything much cleaner now....the actual build console messages are about 1/3 as long as the previous non-gradle builds too. Going to try and implement the auto-gps now. Will post results. TTHHAANNKK YYOOUU! Where do I send the 6 pack of beer too? :-) |
Glad you got it working :-) I will post the relevant parts of this thread in answer to your stackoverflow question so any other poor souls suffering this misery can benefit from this discussion! |
...and lastly. Added the gps enable and it works like a charm. Wish iOS had a method that could be incorporated into this plugin. It is a much cleaner behavior than defaulting to the user settings for them to manually turn it on. |
Regarding an equivalent iOS method, it is technically possible to display such a dialog in iOS, but only by actually requesting a position while location services is turned off. However, because It's something I've vaguely considered adding as an iOS implementation of this plugin (i.e. simply directly requesting a position if location services is OFF), but it does seem a bit of a hack to workaround the non-ideal behaviour of See the first part of this issue thread and this Cordova issue for more. |
I have Google Repository 31 and Google Play Services 31 installed.
C:\Users\RPO\dev\myApp\platforms\android\src\cordova\plugin\RequestLocationAccuracy.java:310: error: cannot find symbol
LocationServices.SettingsApi.checkLocationSettings(
^
symbol: variable SettingsApi
location: class LocationServices
C:\Users\RPO\dev\myApp\platforms\android\src\cordova\plugin\RequestLocationAccuracy.java:450: error: cannot find symbol
case ConnectionResult.SERVICE_MISSING_PERMISSION:
^
symbol: variable SERVICE_MISSING_PERMISSION
location: class ConnectionResult
C:\Users\RPO\dev\myApp\platforms\android\src\cordova\plugin\RequestLocationAccuracy.java:453: error: cannot find symbol
case ConnectionResult.SERVICE_UPDATING:
^
symbol: variable SERVICE_UPDATING
location: class ConnectionResult
C:\Users\RPO\dev\myApp\platforms\android\src\cordova\plugin\RequestLocationAccuracy.java:459: error: cannot find symbol
case ConnectionResult.SIGN_IN_FAILED:
^
symbol: variable SIGN_IN_FAILED
location: class ConnectionResult
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\RPO\dev\myApp\platforms\android\src\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 51.527 secs
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"C:\Users\RPO\dev\myApp\platforms\android\gradlew cdv
BuildDebug -b C:\Users\RPO\dev\myApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
You may not have the required environment or OS to build this project
Error: Error code 1 for command: cmd with args: /s,/c,"C:\Users\RPO\dev\myApp\platforms\android\gradlew cdvBuildDebug -b C:\Users\RPO\dev
\myApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
C:\Users\RPO\dev\myApp>cordova plugin add https://github.com/wf9a5m75/google-play-services#v23
Fetching plugin "https://github.com/wf9a5m75/google-play-services" via git clone
Repository "https://github.com/wf9a5m75/google-play-services" checked out to git ref "v23".
Notice: com.google.playservices has been automatically converted to cordova-plugin-googleplayservices and fetched from npm. This is due to o
ur old plugins registry shutting down.
Plugin "cordova-plugin-googleplayservices" already installed on android.
C:\Users\RPO\dev\myApp>cordova plugin
br.com.dtmtec.plugins.carrier 1.0.0 "Carrier"
cl.rmd.cordova.dialoggps 0.0.2 "DialogGPS"
com.google.playservices 23.0.0 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
com.lampa.startapp 0.1.4 "startApp"
com.ludei.webview.plus 2.4.3 "Webview+"
com.phonegap.plugins.nativesettingsopener 1.0 "Native settings"
com.vliesaputra.deviceinformation 1.0.1 "DeviceInformation"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-apprate 1.1.7 "AppRate"
cordova-plugin-console 1.0.2 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-device-motion 1.2.0 "Device Motion"
cordova-plugin-device-orientation 1.0.2 "Device Orientation"
cordova-plugin-dialogs 1.2.0 "Notification"
cordova-plugin-email 1.1.1 "EmailComposer"
cordova-plugin-fastrde-checkgps 1.0.0 "checkGPS"
cordova-plugin-file 4.1.1 "File"
cordova-plugin-geolocation 2.1.0 "Geolocation"
cordova-plugin-globalization 1.0.2 "Globalization"
cordova-plugin-googleplayservices 19.0.3 "Google Play Services for Android"
cordova-plugin-inappbrowser 1.2.1 "InAppBrowser"
cordova-plugin-request-location-accuracy 1.0.3 "Request Location Accuracy"
cordova-plugin-splashscreen 3.1.0 "Splashscreen"
cordova-plugin-statusbar 2.1.1 "StatusBar"
cordova-plugin-vibration 2.1.0 "Vibration"
cordova-plugin-whitelist 1.2.1 "Whitelist"
cordova-sqlite-storage 0.8.2 "Cordova sqlite storage plugin (core version)"
cordova-universal-links-plugin 1.1.2 "Universal Links Plugin"
cordova.plugins.diagnostic.api-22 2.3.10-api-22 "Diagnostic"
phonegap-facebook-plugin 0.12.0 "Facebook Connect"
The text was updated successfully, but these errors were encountered: