I followed all the steps as stated in the android installation guide but still, I am continuously facing this error
Could not resolve all files for configuration ':react-native-firebase:debugCompileClasspath'.
> Could not find firebase-messaging.jar (com.google.firebase:firebase-messaging:15.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.2/firebase-messaging-15.0.2.jar
> Could not find multidex.jar (com.android.support:multidex:1.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex-1.0.2.jar
> Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.3).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.3/runtime-1.0.3.jar
Here are my build.gradle files look something just like this -
android/build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
android/app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.enappd.teleflix"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile(project(':react-native-firebase')) {
transitive = false
}
// implementation project(':react-native-firebase')
compile project(':react-native-splash-screen')
compile project(':react-native-video')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.0.2"
compile "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:15.0.0"
implementation "com.google.firebase:firebase-core:15.0.2"
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
I have gone through the issues of people facing similar bugs but still nothing seems to be working out.
Thanks for the help in advance ;)
I am running into the same issue
I fixed this error after some few changes, don't know which one had the actual impact though. Here are my gradle files:
project/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
// jitpack repo is necessary to fetch ucrop dependency
maven { url "https://jitpack.io" }
}
}
}
Apparently moving the google() to the top of the repositories fixes some issues I was facing, according to this answer. It did for me.
project/app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.affinitysw"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation project(':react-native-vector-icons')
implementation project(':react-native-wheel-datepicker')
implementation project(':react-native-image-crop-picker')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:23.0.1"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation 'com.google.firebase:firebase-core:15.0.2'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
As I said, I don't know exactly what made it work, but I hope it helps you!
@gabsschneider thank you!
for me the line with "com.google.android.gms:play-services-base:15.0.1"
from file project/app/build.gradle
needed to be replaced. That's what f*cked up my project.
Thank You!
Thank you! @gabsschneider It worked for me!
@cristianonescu @prateek3255 you're welcome!
Thank You!!! @gabsschneider I had the same issue!
Hi, I am also trying to add the react-native-firebase but looking at this example https://rnfirebase.io/docs/v4.3.x/auth/phone-auth#signInWithPhoneNumber I am not sure where to add firebase configuration
var config = {
apiKey: "
authDomain: "
databaseURL: "https://
projectId: "
storageBucket: "
messagingSenderId: "
};
firebase.initializeApp(config);
Can you please tell me the steps to do PhoneNumber authentication?
thank you
Thanks @gabsschneider !!
Moving the google() to the top of the repositories fixed my issue.
Thanks @gabsschneider
It worked for me!
Was facing the same issue, This solution worked for me.
Thanks @gabsschneider!
Most helpful comment
Thanks @gabsschneider !!
Moving the google() to the top of the repositories fixed my issue.