0

I need to set up my react-native app with firebase and I followed the firebase setup guide and after that rerun the app but it fails with giving me errors, I tried lots of solutions that available on the internet but still my issue is not fixed.

if anyone have got this issue before and fixed it already, could you please help me to fix this issue.

this is the error:

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.gms:play-services-measurement:12.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
       - https://jitpack.io/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.pom
       - https://jitpack.io/com/google/android/gms/play-services-measurement/12.0.1/play-services-measurement-12.0.1.aar
     Required by:
         project :app > com.google.firebase:firebase-analytics:17.2.0
   > Could not find com.google.android.gms:play-services-measurement-api:12.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
       - https://jitpack.io/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.pom
       - https://jitpack.io/com/google/android/gms/play-services-measurement-api/12.0.1/play-services-measurement-api-12.0.1.aar
     Required by:
         project :app > com.google.firebase:firebase-analytics:17.2.0
   > Could not find com.google.android.gms:play-services-measurement-sdk:12.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - file:/home/iswan/.m2/repository/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/react-native/android/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - file:/home/iswan/works/office/xforce/xForceMobile/node_modules/jsc-android/dist/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
       - https://jitpack.io/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.pom
       - https://jitpack.io/com/google/android/gms/play-services-measurement-sdk/12.0.1/play-services-measurement-sdk-12.0.1.aar
     Required by:
         project :app > com.google.firebase:firebase-analytics:17.2.0

build.gradle

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

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "+"
    }
    repositories {
        google()
        maven { url "https://maven.google.com" } 
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.3.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        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")
        }


        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        jcenter()
        maven { url 'https://jitpack.io' }
    }

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.google.android.gms'
                && !details.requested.name.contains('multidex') ) {
                    details.useVersion "12.0.1"
                }
            }
        }
    }
}
5
  • can you check this thread stackoverflow.com/questions/50794020/… Commented Dec 26, 2019 at 10:14
  • @GauravRoy no not working for me Commented Dec 26, 2019 at 10:21
  • show your build.gradle Commented Dec 26, 2019 at 11:11
  • @AjithMadhu add my build.gradle too Commented Dec 26, 2019 at 11:39
  • not this bro .. one inside app/build.gradle Commented Dec 26, 2019 at 12:44

2 Answers 2

1

@AjithMadhu I found the issue, it because of the below section. I hardcoded before a month ago and I didn't notice that one.

subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.google.android.gms'
                && !details.requested.name.contains('multidex') ) {
                    details.useVersion "12.0.1"
                }
            }
        }
    }
Sign up to request clarification or add additional context in comments.

1 Comment

:-) happy to help. bro
0

well this is how I done. please refer this,

android/build.gradle

dependencies {
    classpath("com.android.tools.build:gradle:3.4.2")
    + classpath 'com.google.gms:google-services:4.3.3' // check this line

}   

android/app/build.gradle

dependencies {
+ implementation "com.google.android.gms:play-services-base:17.1.0"
+ implementation 'com.google.firebase:firebase-core:17.2.1'
+ implementation 'com.google.firebase:firebase-messaging:20.0.1'
}

android/ grade.properties

firebaseCoreVersion=17.2.1
firebaseMessagingVersion=20.0.1

MainApplication.java

+ import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
+ import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;

 @Override
protected List<ReactPackage> getPackages() {
  @SuppressWarnings("UnnecessaryLocalVariable")
  List<ReactPackage> packages = new PackageList(this).getPackages();
  packages.add(new RNFirebaseMessagingPackage());
  packages.add(new RNFirebaseNotificationsPackage());      
  return packages;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.