React-native-firebase: Could not find firebase-measurement-connector-impl.aar (com.google.firebase:firebase-measurement-connector-impl:15.0.0)

Created on 28 May 2018  ยท  13Comments  ยท  Source: invertase/react-native-firebase

Issue

Getting this error when I clean & build my project.

Could not find firebase-measurement-connector-impl.aar (com.google.firebase:firebase-measurement-connector-impl:15.0.0).
Searched in the following locations:
    https://jcenter.bintray.com/com/google/firebase/firebase-measurement-connector-impl/15.0.0/firebase-measurement-connector-impl-15.0.0.aar

Here are some of my setup files:

Top level build file

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 { url "https://maven.google.com" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

build.gradle (app)

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.mycompany.myapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "0.0.1"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        renderscriptTargetApi 23
        renderscriptSupportModeEnabled true
    }

    // signingConfigs 

    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-blur')
    implementation(project(':react-native-firebase')) {
          transitive = false
     }

    // Firebase dependencies
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation "com.google.android.gms:play-services-fitness:15.0.1"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation 'com.google.firebase:firebase-auth:15.1.0'

    dependencies {
        implementation(project(':react-native-fbsdk')){
            exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
        }
        implementation "com.facebook.android:facebook-android-sdk:4.33.0"
    }
    implementation(project(':react-native-device-info')) {
        exclude group: 'com.google.android.gms'
    }
    implementation(project(':react-native-google-fit')) {
        exclude group: 'com.google.android.gms'
    }

    implementation project(':react-native-photo-view')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-splash-screen')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:26.0.0"
    implementation "com.facebook.react:react-native:0.55.4"  // From node_modules
}

// 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'

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Environment

  1. Application Target Platform: Both (issue on Android)
  1. Development Operating System: maxOS Sierra
  1. Build Tools:
    Android Studio version : 3.1.1
  1. React Native version: 0.55.4

Package.json

{
  "name": "App name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@shoutem/theme": "^0.11.1",
    "@shoutem/ui": "^0.23.4",
    "adm-zip": "^0.4.11",
    "crypto-js": "^3.1.9-1",
    "plist": "^3.0.1",
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-blur": "^3.2.2",
    "react-native-dash": "^0.0.8",
    "react-native-device-info": "^0.21.5",
    "react-native-easy-toast": "^1.1.0",
    "react-native-elevated-view": "^0.0.6",
    "react-native-fbsdk": "^0.7.0",
    "react-native-firebase": "^4.2.0",
    "react-native-google-fit": "^0.5.2",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-onboarding-swiper": "^0.6.0",
    "react-native-pedometer": "^0.0.7",
    "react-native-simple-gauge": "^0.1.10",
    "react-native-splash-screen": "^3.0.6",
    "react-navigation": "1.5.11",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-persist": "^5.9.1",
    "redux-thunk": "^2.2.0",
    "xcode": "^1.0.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.3",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

  1. RNFirebase Version: 4.2.0
  1. Firebase Module: auth, analytics

Most helpful comment

Got it working after deleting $HOME/.gradle/caches folder.

All 13 comments

I'm having the same problem with v3.2.2

A problem occurred configuring project ':react-native-firebase'.
โ–ธ > Could not find firebase-messaging.aar (com.google.firebase:firebase-messaging:11.6.0).
โ–ธ Searched in the following locations:
โ–ธ https://jcenter.bintray.com/com/google/firebase/firebase-messaging/11.6.0/firebase-messaging-11.6.0.aar

I suppose the problem is related to this issue:
https://stackoverflow.com/questions/48242111/gradle-error-after-update-com-android-toolssdk-common

e.g the order of google and jcenter dependency need to be updated

I've changed it locally and got successful build.

Filed up #1148 regarding this issue.

Now my updated build.gradle looks like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    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()
        google()
        jcenter()
        // maven { url "https://maven.google.com" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

And when I am building the android build from iOS terminal by _react-native run-android_ the build is running fine.

Tried the same with my build:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
    }
    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()
        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://jitpack.io" // required by react-native-camera
        }
    }
}

And this is what I get:

* What went wrong:                                                                                                                                                 โ”‚    "react-native-camera": "^0.12.0",
A problem occurred configuring project ':react-native-firebase'.                                                                                                   โ”‚    "react-native-config": "^0.10.0",
> Could not resolve all files for configuration ':react-native-firebase:classpath'.                                                                                โ”‚    "react-native-firebase": "4.2.0",
   > Could not find builder.jar (com.android.tools.build:builder:3.1.0).                                                                                           โ”‚    "react-native-keychain": "^3.0.0-rc.
     Searched in the following locations:                                                                                                                          โ”‚3",
         https://jcenter.bintray.com/com/android/tools/build/builder/3.1.0/builder-3.1.0.jar                                                                       โ”‚    "react-native-keyevent": "^0.0.7",
   > Could not find sdklib.jar (com.android.tools:sdklib:26.1.0).                                                                                                  โ”‚    "react-native-vector-icons": "^4.5.0
     Searched in the following locations:                                                                                                                          โ”‚",
         https://jcenter.bintray.com/com/android/tools/sdklib/26.1.0/sdklib-26.1.0.jar                                                                             โ”‚    "react-redux": "^5.0.7",
   > Could not find shared.jar (com.android.tools.analytics-library:shared:26.1.0).                                                                                โ”‚    "react-router": "^4.2.0",
     Searched in the following locations:                                                                                                                          โ”‚    "react-router-native": "^4.2.0",
         https://jcenter.bintray.com/com/android/tools/analytics-library/shared/26.1.0/shared-26.1.0.jar

e.g still looking in the jcenter repository when repository order is jcenter google.

Have you ensured all SDKs are updated in Android studio?

Android Studio and SDK are up to date:

screen shot 2018-05-28 at 15 02 38

screen shot 2018-05-28 at 15 02 58

I solved the problem basically by setting the google maven repository before the jcenter one.

At android/build.gradle

repositories {
    mavenLocal()
    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' }
    jcenter()
}

Don't know why but a lot of people is reporting this problem on StackOverflow

Yes in case you are talking about android/build.gradle of react-native-firebase.

No, I'm not talking about the android/build.gradle of the react-native-firebase module. I'm referring to my own project build.gradle file @mgenov

I suppose it's from some kind of caching of the dependencies. The same code works fine on another linux machine.

Got it working after deleting $HOME/.gradle/caches folder.

This will be resolved by: https://github.com/invertase/react-native-firebase/pull/1148 in the next release. Thanks @mgenov

Was this page helpful?
0 / 5 - 0 ratings