Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android依赖性';com.google.android.gms:play services stats';编译(16.0.1)和运行时(17.0.0)类路径的版本不同_Java_React Native_Google Play Services - Fatal编程技术网

Java Android依赖性';com.google.android.gms:play services stats';编译(16.0.1)和运行时(17.0.0)类路径的版本不同

Java Android依赖性';com.google.android.gms:play services stats';编译(16.0.1)和运行时(17.0.0)类路径的版本不同,java,react-native,google-play-services,Java,React Native,Google Play Services,昨天,我的应用程序构建正确,今天,在没有更改任何我无法再构建的内容的情况下,我遇到了以下错误: Android依赖项com.google.Android.gms:play services stats的编译(16.0.1)和运行时(17.0.0)>类路径版本不同。您应该通过>DependencyResolution手动设置相同的版本 我曾多次尝试使用“com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionC

昨天,我的应用程序构建正确,今天,在没有更改任何我无法再构建的内容的情况下,我遇到了以下错误:

Android依赖项com.google.Android.gms:play services stats的编译(16.0.1)和运行时(17.0.0)>类路径版本不同。您应该通过>DependencyResolution手动设置相同的版本

我曾多次尝试使用“com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck=true”绕过这个问题,并清理该项目,但错误仍然存在

我的应用程序/build.gradle文件:

apply plugin: "com.android.application"
apply plugin: "com.android.application"
apply plugin: "io.fabric"

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 rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.yapero"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        multiDexEnabled true
        versionCode 743
        versionName "1.74"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        versionNameSuffix '3'
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    packagingOptions {
        exclude 'META-INF/main.kotlin_module'
        exclude 'META-INF/-no-jdk.kotlin_module'
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    // 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, "arm64-v8a": 3]
            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(':@segment_analytics-react-native')
    implementation project(':react-native-webview')
    implementation project(':react-native-version-check')
    implementation project(':react-native-firebase')
    implementation(project(':react-native-firebase')) {   
       transitive = false
   }
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {transitive = true}
    //implementation project(':react-native-version-check')
    implementation project(':react-native-maps')
    implementation project(':react-native-intercom')
    implementation 'io.intercom.android:intercom-sdk-base:5.+'
    implementation 'io.intercom.android:intercom-sdk-fcm:5.+'
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-device-info')
    implementation project(':react-native-appsflyer')
    implementation project(':react-native-text-input-reset')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-fast-image')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.firebase:firebase-core:16.0.8"
    implementation "com.google.firebase:firebase-auth:16.2.1"
    implementation "com.google.firebase:firebase-firestore:17.1.5"
    implementation "com.google.firebase:firebase-messaging:17.5.0"
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    implementation 'com.android.support:multidex:1.0.0'
}

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

我的身材。格雷德尔:

buildscript {
    ext {
        buildToolsVersion = "28.0.2"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 27
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.25.4'
        // 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"
        }
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
    distributionUrl = distributionUrl.replace("bin", "all")
}
是否有人知道如何更正或绕过此版本检查?如果您需要更多信息,请询问我。

为您(和我)的问题提供了答案:

依赖项(
react native device info,在本例中为
)正在使用其依赖项之一的最新版本,而不是固定/固定版本。当google services的新版本发布时,它导致构建为
设备信息
引入新版本,从而导致与正确定位所需版本的其他依赖项发生冲突

解决方案是按照你的
android/app/build.gradle
中的链接帖子中的说明进行操作:

implementation(project(":react-native-device-info"),  {
  exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"

并可能将
react native device info
替换为可能存在相同问题的任何其他依赖项(它们将包括
实现“com.google.android.gms:play services gcm:+”
,这取决于谷歌gcm的最新版本)。

添加到文件中:android/app/build.gradle

android {
    ...
    dependencies {
        implementation 'com.google.android.gms:play-services-maps:17.0.0'
    }

有什么东西阻止你升级到更新的gms吗?我刚刚在发布我的问题后看到了你的问题。我们似乎也有同样的问题@M.Prokhorov升级会给我带来新的错误,并与react native产生冲突-firebase@LaurentS是的,是一样的,我还发现了依赖项“com.google.android.gms:play-services-base”的错误,这可能是一个罪魁祸首:此解决方案帮助我在调试模式下运行应用程序,但当我尝试使用“gradlew assembleerelease”构建APK时,仍然会出错。@jmn try app:assembleerelease