transistorsoft / cordova-background-geolocation-firebase

Firebase Adapter for Cordova Background Geolocation
MIT License
7 stars 5 forks source link

cordova build failing on firebase and play-services dependencies #3

Closed invention7 closed 5 years ago

invention7 commented 5 years ago

Hi Chris,

I know from the main repository's issues that play-services versioning tends to be the bane of your existence. Hoping you've got an immediate idea, if not, I'll continue tinkering.

I can build fine with cordova-background-geolocation (I've hosed platforms/ and plugin/ rebuilt the android platform and works fine). Once I add cordova-background-geolocation-firebase and do an android build, I fail with :

What went wrong: Failed to notify dependency resolution listener.

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.4,15.0.4], [16.0.2,16.0.2]], but resolves to 16.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies. The library com.google.firebase:firebase-analytics-impl is being requested by various other libraries at [[16.0.0,16.0.0], [16.2.1,16.2.1]], but resolves to 16.2.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Pasting below my templated config.xml (I use a project called 'ionic-config' to fill in variables per my 'dev', 'staging', and 'prod' platforms)

Any ideas are appreciated.

Thanks for the help.

<?xml version='1.0' encoding='utf-8'?>

{{name}} Ryplz, LLC 1597726337191073 Air Castle
christocracy commented 5 years ago

post your platforms/android/project.properties

invention7 commented 5 years ago

target=android-27 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.gradle.include.1=com-sarriaroman-photoviewer/dev-photoviewer.gradle cordova.gradle.include.2=cordova-plugin-background-fetch/dev-build.gradle cordova.system.library.1=com.google.android.gms:play-services-location:15.0.1 cordova.system.library.2=com.android.support:appcompat-v7:27.0.0 cordova.gradle.include.3=cordova-background-geolocation/dev-build.gradle cordova.gradle.include.4=cordova-plugin-badge/dev-badge.gradle cordova.system.library.3=com.android.support:support-v4:24.1.1+ cordova.system.library.4=com.facebook.android:facebook-android-sdk:4.36.0 cordova.gradle.include.5=cordova-plugin-firebase/dev-build.gradle cordova.system.library.5=com.google.gms:google-services:+ cordova.system.library.6=com.google.android.gms:play-services-tagmanager:+ cordova.system.library.7=com.google.firebase:firebase-core:+ cordova.system.library.8=com.google.firebase:firebase-messaging:+ cordova.system.library.9=com.google.firebase:firebase-crash:+ cordova.system.library.10=com.google.firebase:firebase-config:+ cordova.system.library.11=com.google.firebase:firebase-perf:+ cordova.system.library.12=com.android.support:support-annotations:27.+ cordova.system.library.13=com.android.support:support-v4:26.+ cordova.gradle.include.6=cordova-plugin-local-notification/dev-localnotification.gradle cordova.gradle.include.7=cordova-support-google-services/dev-build.gradle cordova.system.library.14=com.google.firebase:firebase-core:15.0.0 cordova.system.library.15=com.google.firebase:firebase-firestore:15.0.0 cordova.gradle.include.8=cordova-background-geolocation-firebase/dev-build.gradle

christocracy commented 5 years ago

Your dependencies are a mess of conflicting versions.

invention7 commented 5 years ago

ok.

I just reverted to my working code (pre cordova-background-geolocation-firebase install). Axed plugins/ and platforms/ Did a clean add of android platform and built successfully.

Posting the resulting project.properties below. Does this offer you any opportunity for insight into what is causing the mess of conflicting versions?

(in other words, the project.properties below builds; when I add the plugin, I get the project.properties above. Can you glean any area to focus my investigation?)

target=android-27 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.gradle.include.1=com-sarriaroman-photoviewer/dev-photoviewer.gradle cordova.gradle.include.2=cordova-plugin-background-fetch/dev-build.gradle cordova.system.library.1=com.google.android.gms:play-services-location:15.0.1 cordova.system.library.2=com.android.support:appcompat-v7:27.0.0 cordova.gradle.include.3=cordova-background-geolocation/dev-build.gradle cordova.gradle.include.4=cordova-plugin-badge/dev-badge.gradle cordova.system.library.3=com.android.support:support-v4:24.1.1+ cordova.system.library.4=com.facebook.android:facebook-android-sdk:4.36.0 cordova.gradle.include.5=cordova-plugin-firebase/dev-build.gradle cordova.system.library.5=com.google.gms:google-services:+ cordova.system.library.6=com.google.android.gms:play-services-tagmanager:+ cordova.system.library.7=com.google.firebase:firebase-core:+ cordova.system.library.8=com.google.firebase:firebase-messaging:+ cordova.system.library.9=com.google.firebase:firebase-crash:+ cordova.system.library.10=com.google.firebase:firebase-config:+ cordova.system.library.11=com.google.firebase:firebase-perf:+ cordova.system.library.12=com.android.support:support-annotations:27.+ cordova.system.library.13=com.android.support:support-v4:26.+ cordova.gradle.include.6=cordova-plugin-local-notification/dev-localnotification.gradle

christocracy commented 5 years ago

for one thing, all com.android.support dependencies should be aligned and correspond to your target=android-27.

cordova.system.library.2=com.android.support:appcompat-v7:27.0.0 
cordova.system.library.3=com.android.support:support-v4:24.1.1+ 
cordova.system.library.12=com.android.support:support-annotations:27.+ 
cordova.system.library.13=com.android.support:support-v4:26.+ 
invention7 commented 5 years ago

I know on the regular cordova-background-geolocation issues, I've seen some success using plugins like cordova-android-play-services-gradle-release and cordova-android-firebase-gradle-release to align versions. Do you think using some combinations of plugins is a viable route, or do you think the choice is really to manually align the versions in project.properties? (and maybe codifying in a cordova hook to make a repeatable process?)

christocracy commented 5 years ago

make it build by manually tweaking first.

invention7 commented 5 years ago

I'll give it a go and get back to you. Thanks, Chris.

invention7 commented 5 years ago

Thanks for the guidance, Chris. Got it building and codified the explicit versions in a build-extras.gradle which I've got coming in to platforms/android via a hook. Closing

syedsaadqamar commented 5 years ago

@christocracy I had the same issue but I had changed it by changing

cordova.system.library.1=com.google.android.gms:play-services-location:16.+

to

cordova.system.library.1=com.google.android.gms:play-services-location:15.+

in platforms/android/project.properties

Locally that works but when I push the code on dashboard.ionicframework and build the app it fails there because we don't push the platform folder in dashboard.ionicframework, could you please help me what should I do to resolve that issue?

christocracy commented 5 years ago

See the README for GOOGLE_API_VERSION

syedsaadqamar commented 5 years ago

Installed GOOGLE_API_VERSION=15.+ but it does not work

christocracy commented 5 years ago

Logs.

syedsaadqamar commented 5 years ago

How can get logs?

syedsaadqamar commented 5 years ago

FAILURE: Build failed with an exception.

syedsaadqamar commented 5 years ago

Installed plugin

"cordova-background-geolocation-firebase": "0.0.1",
"cordova-support-google-services": "^1.2.1",
"cordova": {
    "plugins": {
      "cordova-background-geolocation": {
        "GOOGLE_API_VERSION": "15.+",
        "APPCOMPAT_VERSION": "27.1.1",
        "BACKGROUND_MODE_LOCATION": "<string>location</string>",
        "LOCATION_ALWAYS_AND_WHEN_IN_USE_USAGE_DESCRIPTION": "Always use is required for constant background location-tracking",
        "LOCATION_ALWAYS_USAGE_DESCRIPTION": "Background location-tracking is required",
        "LOCATION_WHEN_IN_USE_USAGE_DESCRIPTION": "Background location-tracking is required",
        "MOTION_USAGE_DESCRIPTION": "Using the accelerometer increases battery-efficiency by intelligently toggling location-tracking only when the device is detected to be moving"
      },
      "cordova-support-google-services": {},
      "cordova-background-geolocation-firebase": {
        "LICENSE": "",
        "FIREBASE_CORE_VERSION": "15.+",
        "FIREBASE_FIRESTORE_VERSION": "17.1.0"
      }
}
christocracy commented 5 years ago

I need to document these two --variable of the firebase adapter.

I would start by making sure all the Google dependencies are importing latest versions. You can determine latest versions by browsing the tree @ http://maven.google.com

Test on your local build first. Ensure your project.properties reflects these updated versions.

christocracy commented 5 years ago

I probably need to update the cordova-support-google-services dependency as well, which is at 1.3.1 now.

It's been a while since I've tested the firebase adapter for Cordova. I'll whip up a Hello World on Monday using latest dependencies.

syedsaadqamar commented 5 years ago

Thanks @christocracy, It works!