Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Added Android SDK conflict issues #811

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down