From c9d08ab61d0a9bd5e9fa6100bc134e32243e8399 Mon Sep 17 00:00:00 2001 From: Tamas Polgar Date: Sun, 22 Jul 2018 11:38:56 -0400 Subject: [PATCH] Added Android conflict issues Because this plugin rules, but compatibility issues suck! --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 3f7c5059..6a5430cb 100755 --- a/README.md +++ b/README.md @@ -64,6 +64,36 @@ If you're using this template: [vue-cli-template](https://github.com/nativescrip And also, `require` the plugin before Vue.start runs (probably in `main.js`), but run `firebase.init()` afterwards (although it may work before). You could wrap it in a timeout to make sure. +### Android SDK conflicts +Some users experienced build conflicts after installing the plugin. SDK version issues may prevent your app from building and installing on a physical Android device. Here is what you should do. + +After starting your NativeScript project, adding and configuring the plugin, registering your app on Firebase Console and adding `google-services.json` to your `App_Resources/Android` directory, try `tns run android` on your device. Gradle may fail and produce various error messages similar to this: + +`.../values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.` + +This is caused by an Android SDK incompatibility. You can fix it by modifying `platforms/android/app/build.gradle`. Change this part: + +``` +defaultConfig { + minSdkVersion 17 + targetSdkVersion computeTargetSdkVersion() + ... +} +``` + +to this: + +``` +defaultConfig { + minSdkVersion 17 + targetSdkVersion 26 + multiDexEnabled true + ... +} +``` + +This forces Gradle to use API 26. Lower versions miss a few components required for the build. Of course you can set it even higher if you need a newer API. Multidex is also needed for a successful build. Don't forget to set this again if you update or change the project's Android platform. + ### iOS (Cocoapods) The Firebase iOS SDK is installed via Cocoapods, so run `pod repo update` from the command prompt (in any folder) to ensure you have the latest spec.