In attempting to compile a previously working Android app with Android Studio 3.5.2, Android SDK 28 and the cordova-plugin-firebase I read here that I should install cordova-plugin-firebasex as a working and currently maintained fork that works on Androidx.
First issue, removing the cordova-plugin-firebase, I resolved as follows:
You cannot remove this plugin with the conventional method
cordova plugin remove cordova.plugin.firebase --save
This removes the entire /main directory due to a bug in the plugin.xml file:
<resource-file src="src/android/google-services.json" target="."/>
and the uninstall fails.
I removed that line from the XML file and again attempted to remove the plugin via the cli.
That results in this message:
Using "requireCordovaModule" to load non-cordova module "xcode" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
Following instructions here I edited plugins/cordova-plugin-firebase/scripts/ios/helper.js
I added
var xcode = require("xcode");
at the top of the file and remove two instances of
var xcode = context.requireCordovaModule("xcode");
Again attempt removal of plugin and got
Uninstalling cordova-plugin-firebase from ios Uninstalling cordova-plugin-firebase from osx Removing "cordova-plugin-firebase" Cannot find plugin.xml for plugin "cordova-plugin-google-analytics".
I removed and reinstalled the google analytics plugin, and the firebase plugin successfully uninstalled.
I've then added Firebasex and the recommended version wranglers for play services and firebase:
cordova plugin add cordova-plugin-firebasex
cordova plugin add cordova-android-play-services-gradle-release
cordova-android-firebase-gradle-release
I get the following compile errors:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'. In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0. 1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown. Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[ 15.0.1], but play-services-basement version was 17.0.0.
I've tried grepping my entire directory for ':15.0.1' and '@15.0.1' but I cannot find the culprit. I tried uninstalling a reinstalling the plugin with the following version specifiers:
cordova plugin add cordova-plugin-firebasex \
--variable ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION=17.0.0 \
--variable ANDROID_FIREBASE_CORE_VERSION=17.0.0 \
--variable ANDROID_FIREBASE_MESSAGING_VERSION=19.0.0 \
--variable ANDROID_FIREBASE_CONFIG_VERSION=18.0.0 \
--variable ANDROID_FIREBASE_PERF_VERSION=18.0.0 \
--variable ANDROID_FIREBASE_AUTH_VERSION=18.0.0 \
--variable ANDROID_CRASHLYTICS_VERSION=2.10.1 \
--variable ANDROID_CRASHLYTICS_NDK_VERSION=2.1.0 \
and that spits up a new dependency mismatch:
Could not determine the dependencies of task ':app:preReleaseBuild'.
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[11.0. 1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown. Dependency failing: com.google.android.gms:play-services-tagmanager-v4-impl:11.0.1 -> com.google.android.gms:play-servic es-basement@[11.0.1], but play-services-basement version was 17.0.0.
So I've also tried pushing all libraries to their most recent versions, resulting in the following build.gradle for the app:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-perf:19.0.1'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation "com.google.android.gms:play-services-tagmanager:17.0.0"
implementation "com.google.firebase:firebase-core:17.2.1"
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-perf:19.0.1'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation "com.crashlytics.sdk.android:crashlytics:2.10.1"
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.1'
implementation "me.leolin:ShortcutBadger:1.1.22"
// SUB-PROJECT DEPENDENCIES END }
Which spits me back to
Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[ 15.0.1], but play-services-basement version was 17.0.0.
I'm still a noob at Library dependencies (though I've been hiking up the learning curve for the last three days to the point I need oxygen) -- how can I find the culprit here, and why are the plugins that are supposed to do that for me failing?