找不到play-services-base.jar(com.google.android.gms:play-services-base:11.8.0)

时间:2018-09-18 18:34:03

标签: android react-native react-native-android

当我想在react-native中建立一个项目时出现此错误:

  

这是我的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
def googlePlayServicesVersion = '11.8.0'

buildscript {
    repositories {
        jcenter()
        google()
        mavenCentral()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        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


    }
}

def versionOverrides = [
        "com.facebook.android:facebook-android-sdk": "4.22.1",
]

project(':react-native-fbsdk') {
    configurations.all {
        resolutionStrategy {
            force 'com.facebook.android:facebook-android-sdk:4.22.1'
        }
    }
}

allprojects {
    repositories {
        // Add jitpack repository (added by tipsi-stripe)
        maven { url "https://jitpack.io" }
        mavenLocal()
        jcenter()
         google()
          maven { url "https://jitpack.io" }
        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/'
            name 'Google'
        }
    }
    configurations.all {
            resolutionStrategy {
                    // react-native-admob
                    force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"

                    // react-native-onesignal
                    force "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
                    force "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
                    force "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
                    force 'com.facebook.android:facebook-android-sdk:4.22.1'
             }

            resolutionStrategy.eachDependency { DependencyResolveDetails details ->

                def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]

                if (overrideVersion != null && details.requested.version != overrideVersion) {
                    println("********************************************************")
                    println("Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion")
                    details.useVersion overrideVersion
                    println("********************************************************")
                }
            }
        }
}


 subprojects {
  project.configurations.all {
     resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "26.1.0"
        }
     }
  }
}

0 个答案:

没有答案