I am having an interesting problem. I have a react native expo project, bare minimum so it doesn't use any of expo servers and all, and its pure react native project included with react-native-unimodules. So now I want to integrate react-native-firebase in it, IOS was successful but on android I am facing multiple issues, Let's start from the beginning.
1: First I tried to do react-native link firebase...
, then i rechecked that all the linking has been done, eg checked settings.gradle, MainApplicaiton.java etc etc, once everything was in the place, after running react-native run-android
. The first issue i get it
Could not find method platform() for arguments [com.google.firebase:firebase-bom:21.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Okay, So I researched a bit, and everywhere I see, there is a single solution to this, upgrading gradle. So I upgraded gradle to 5.1.1 and even tried few others, After upgrading the error I get it is.
Cannot add task 'wrapper' as a task with that name already exists
So again I researched a bit, and then I tried removing it or adding this solution Cannot add task 'wrapper' as a task with that name already exists It worked (Kind of), now I have another error.
After all this, When i try to compile, I get this one.
ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
I tried to troubleshoot this one too, adding googlePlayServices, firebase
in my ext and so on.
Nothing works though.
So now I am stuck and its very important to integrate react-native-firebase along with unimodules.
Help would be appreciated. I will post some info about my app here, this stage would be before I tried integrating anything. android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url 'https://maven.google.com' }
maven { url "https://www.jitpack.io" }
}
}
//task wrapper(type: Wrapper) {
// gradleVersion = '4.7'
// distributionUrl = distributionUrl.replace("bin", "all")
//}
wrapper {
gradleVersion = '5.1'
distributionUrl = distributionUrl.replace("bin", "all")
}
My dependencies
dependencies {
implementation project(':@react-native-firebase_app')
implementation project(':appcenter-analytics')
implementation project(':appcenter')
implementation project(':react-native-splash-screen')
implementation project(':react-native-sms-retriever')
implementation project(':react-native-image-crop-picker')
implementation project(':@sentry-react-native')
implementation project(':react-native-config')
implementation project(':react-native-onesignal')
implementation project(':react-native-code-push')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-reanimated')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-vector-icons')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
addUnimodulesDependencies()
}
react-native info
React Native Environment Info:
System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz
Memory: 86.16 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.6.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.2 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.10 => 0.59.10
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7