当前位置: 首页 > 知识库问答 >
问题:

'com.google.Androidgms:play services base“对于编译(15.0.1)和运行时(16.0.1)有不同的功能

阳勇
2023-03-14

我在构建应用程序时收到以下错误

Android依赖项'com.google.android.gms: play-services-base'的编译(15.0.1)和运行时(16.0.1)类路径版本不同。您应该通过Dependency分辨率手动设置相同的版本

APP/build.gradle文件

    apply plugin: "com.android.application"

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 26
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.afbmobilebanking"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 14
        versionName "1.0.9"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            debuggable false
            // minifyEnabled true
            // shrinkResources true
            signingConfig signingConfigs.release
            //  minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    lintOptions {
        abortOnError false
    }
    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-maps')
    implementation project(':react-native-i18n')
    implementation project(':react-native-device-info')
    implementation project(':react-native-maps')
    implementation project(':react-native-device-info')
    implementation project(':react-native-i18n')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.facebook.fresco:animated-gif:1.3.0'
//    implementation(project(':react-native-maps')) {
//        exclude group: 'com.google.android.gms', module: 'play-services-base'
//        exclude group: 'com.google.android.gms', module: 'play-services-maps'
//    }
    implementation 'com.google.android.gms:play-services-base:15.0.1'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
}

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

请让我知道如何解决这个问题。

共有3个答案

王彭薄
2023-03-14
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:0.20.1"  // From node_modules
implementation "com.google.android.gms:play-services-base:16.1.0"

在构建中添加实现“com.google.android.gms: play-services-base: 16.1.0”。Gradle/app,它对我有用。

通寂离
2023-03-14

删除实现项目(“:react native maps”)的重复声明,如果与react native maps库冲突,则用实现项目(“:react native maps”)替换下面的代码。

implementation(project(':react-native-maps')) {
       exclude group: 'com.google.android.gms', module: 'play-services-base'
} 
斜高翰
2023-03-14

您的一些LIB可能依赖于play服务。您可以使用以下命令查看依存关系树:

$ ./gradlew app:dependencies

然后,您可以从lib中排除冲突的依赖项,或者尝试将所有lib升级到最新版本,或者尝试使用

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
 类似资料:
  • 问题内容: 昨天我的应用程序正确构建,今天没有更改我无法构建的任何内容,我收到此错误: Android依赖项“ com.google.android.gms:play-services- stats”具有不同的编译版本(16.0.1)和运行时版本(17.0.0)> classpath。您应该通过> DependencyResolution手动设置相同的版本 我尝试使用“ com.google.gm

  • 将Android Studio从Canary 3更新到Canary 4后,在构建时抛出以下错误。 Android依赖项“com.Android.support:support-support-v4”的编译类路径(25.2.0)和运行时类路径(26.0.0-beta2)版本不同。您应该通过DependencyResolution手动设置相同的版本。 app-build.gradle Library-

  • 问题内容: 我正在编译glibc库。在我可以这样做之前,我需要先跑步。但是,要编译glibc,我需要使用gcc编译器,它不是计算机上的默认编译器。该手册说明以下内容。 现在,我的问题是我对该计算机没有任何管理权限。因此,如何使用不同于默认值的编译器。 问题答案: 在linux上,任何人都可以更改其进程的环境变量。不需要管理权限。 在bash中: 在csh中使用 在该命令之后在此shell中启动的任

  • 问题内容: 我尝试过一些关于绑定和未绑定方法的代码。当我们调用它们时,我认为它们都会返回对象。但是,当我用于获取一些信息时,它返回的内容我并不理解。 IDE:Eclipse 插件:pydev 输出是… 为什么#1和#2返回相同的ID?他们不是不同的对象吗?如果我们分配和两个变量,#3,#4回报不同的ID。 我认为#3和#4表明它们不是同一对象,而是#1和#2 … 绑定方法的ID和未绑定方法的ID有

  • 编译和运行 cd tb // make //编译 xt-run --turbo ./output/dsp.elf ./audio_data (或者make run)// 程序默认开启了aec算法,程序执行完后,你会看到目录 audio_data下多了一个 output.wav,这个是第0录mic经过aec后的音频输出。 gdb调试 修改 Makefile,将优化级别改成 -O0 xt-gdb -

  • 编译和运行 cd tb // make //编译 xt-run --turbo ./output/dsp.elf ./audio_data // 程序默认开启了aec算法,程序执行完后,你会看到目录 audio_data下多了一个 output.wav,这个是第0录mic经过aec后的音频输出。 gdb调试 修改 Makefile,将优化级别改成 -O0 xt-gdb --args ./out