android - 哪个依赖性导致 “Failed resolution Failed resolution of: Lcom/google/android/gms/common/internal/zzab;”

标签 android react-native gradle dependencies react-native-android

我没有使用Firebase,这似乎是other问题的原因people
这是错误的屏幕截图:

enter image description here

这是我的依赖项列表:

dependencies {
    implementation project(':react-native-connectivity-status')
    implementation project(':react-native-i18n')
    implementation project(':react-native-svg')
    implementation project(':react-native-extra-dimensions-android')
    implementation project(':react-native-google-analytics-bridge')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-spinkit')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-picker')
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.facebook.react:react-native:+'
    // From node_modules
    implementation 'com.facebook.fresco:fresco:1.3.0'
    implementation 'com.facebook.fresco:animated-gif:1.3.0'
    implementation project(':blelibrary')
    implementation project(':gaialibrary')
    implementation project(':vmupgradelibrary')
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation project(':react-native-connectivity-status')

    implementation("com.google.android.gms:play-services-basement:15.0.1")
    implementation("com.google.android.gms:play-services-base:15.0.1")
} 

和更多信息
android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.someapp"
        minSdkVersion 19
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 28
        versionName "1.2.4"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        packagingOptions {
            exclude "lib/arm64-v8a/libgnustl_shared.so"
        }
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_STL=c++_static'
            }
        }
    }

确定哪个依赖关系导致错误出现的最佳方法是什么?

这是根目录下的build.gradle。
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {

        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        // classpath 'com.google.gms:google-services:4.2.0'
        // 4.2.0 is the latest version of com.google.gms:google-services:4.2.0 as of Jan 15, 2019

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        configurations.all {
            resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
                if (requested.group == 'com.google.android.gms') {
                    details.useVersion '15.0.1'
                }
            }
        }
        // Add jitpack repository (added by react-native-spinkit)
        maven { url "https://jitpack.io" }
        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/'
            name 'Google'
        }
        jcenter()
    }

}

我还按照Andrew的指示更新了Main.Application.java文件。

最佳答案

您有implementation project(':react-native-google-analytics-bridge')在gradle文件中,如果打开项目依赖项,则会看到它正在使用implementation "com.google.android.gms:play-services-analytics:${safeExtGet('googlePlayServicesVersion', '+')}"
这就是问题所在。您在gradle的依赖项中使用其他版本。您可以使用依赖性解析

    allprojects {
    repositories {
    //start here
    configurations.all {
 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
   def requested = details.requested
       if (requested.group == 'com.google.android.gms') {
          details.useVersion '15.0.1'
       }
       }
     }
    //end
     jcenter()
       maven {
         url "https://maven.google.com"
       }
     }
 }

或可以将默认+版本用于 implementation("com.google.android.gms:play-services-basement:15.0.1") implementation("com.google.android.gms:play-services-base:15.0.1")。记住要保持版本相同。

关于android - 哪个依赖性导致 “Failed resolution Failed resolution of: Lcom/google/android/gms/common/internal/zzab;”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54194935/

相关文章:

ios - 未找到 RCTBridgeModule - RNGoogleSignin

android - 如何根据 android 构建变体包含不同的 .aar

android - 为什么你必须在 Android studio 3.0+ 中泄漏父类(super class)型的依赖?

android - 如何在安装过程中将文件从 Assets 复制到 SD 卡

android-studio - 如何将-http-proxy添加到从Android Studio 2.0启动的android模拟器中

node.js - 由于 bcrypt 错误,Npm 安装失败

java - 停止应用程序后,Gradle 未关闭端口

java - Gradle:强制使用另一个操作系统

Android 对话框仅在第二次单击时关闭。为什么?

android - 从安卓设备运行谷歌脚本