Google Play控制台上传错误消息:无法根据设备配置声明Google Play服务的不同版本

发布于 2025-01-23 19:07:49 字数 7294 浏览 1 评论 0原文

将完成的应用程序捆绑包上载到Google Play游戏机时,我遇到了问题。下载后,我得到此消息:
“该应用无法根据设备配置声明不同版本的Google Play服务。找到以下版本:[0,12451000]“

该应用显示底部智能横幅(Google ADS),使用网络除了算法之外,它还没有多大作用。

build.gradle:

ext {
    version = '1.0'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.6.21'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0-alpha09'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle:app:

plugins {
    id 'kotlin-android'
    id 'org.jetbrains.kotlin.kapt'
    id 'com.android.application'
}

android {
    ...
    signingConfigs {
        debug {
            ...
        }
        release {
            ...
        }
    }
    compileSdk 32
    buildToolsVersion '30.0.3'
    defaultConfig {
        minSdk 19
        targetSdk 32
        versionName '1.0'
        versionCode 100
        multiDexEnabled true
        ...
    }

    buildFeatures {
        //noinspection DataBindingWithoutKapt
        dataBinding true
        viewBinding true
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
        }
        beta {
            applicationIdSuffix ".beta"
            versionNameSuffix "-beta"
        }
        release {
            applicationIdSuffix ".release"
            versionNameSuffix "-release"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility "11"
        targetCompatibility "11"
    }
    kotlinOptions {
        jvmTarget = "11"
    }
    ndkVersion '25.0.8221429 rc2'
    flavorDimensions "level"
    productFlavors {
        free {
            ...
            dimension "level"
            versionCode 100
            versionName "1.0"
            targetSdk 32
            minSdk 19
            signingConfig signingConfigs.release
        }
        pro {
            ...
            dimension "level"
            versionCode 100
            versionName "1.0"
            targetSdk 32
            minSdk 19
            signingConfig signingConfigs.release
        }
    }
    sourceSets {
        free {
            java { srcDirs 'src/free/java' }
            res { srcDirs 'src/free/res' }
        }
        pro {
            java { srcDirs 'src/pro/java' }
            res { srcDirs 'src/pro/res' }
        }
    }
    lint {
        checkReleaseBuilds false
    }
    dependenciesInfo {
        includeInApk true
        includeInBundle true
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1-native-mt'
    implementation 'androidx.appcompat:appcompat:1.6.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'io.reactivex.rxjava3:rxjava:3.1.4'
    implementation 'com.google.android.gms:play-services-ads:20.6.0'
    implementation 'com.android.support:multidex:1.0.3'
}
task wrapper(type: Wrapper) {
    gradleVersion = '7.3'
}

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingLeanbackLauncher">

    <!-- Need to listen to UDP datagrams -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- For Android S devices & GMA SDK version 20.3.0 or lower -->
    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

    <!-- Support Android TV and do not require a touchscreen -->
    <uses-feature
        android:name="android.software.leanback"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/MyTheme.Blue.SplashScreen">
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="<APP_KEY>" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <activity
            android:name=".ActivitySplash"
            android:exported="true"
            android:theme="@style/MyTheme.Blue.SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Preference activity -->
        <activity
            android:name=".ActivityMain"
            android:exported="true"
            android:theme="@style/MyTheme.Blue.SplashScreen">
        </activity>
    </application>

</manifest>

与我评论过的问题相关的链接:
不同版本的Google Play服务无法根据设备配置声明
应用程序无法根据设备配置声明不同版本的Google Play服务
无法根据设备配置声明Google Play服务
https://issuetracker.google.google.com/issues/issues/2223240933636#Comment21 https://issuetracker.google.google.com/issues/issues/2223240936


完成:

  • 挖掘Gradle文档以具有更好的理解(插件,实现)。老实说,我从来没有做过这项工作,因为它总是与我刚刚适应的基本gradle一起工作。这是一个调整许多不一致之处的机会(虽然仍然可以是一些)。
  • 请求Google开发人员的支持(尚无答案)
  • 当然,

:清洁项目,现金无效,但我仍然完全陷入困境。我不知道如何解决这个问题。

这是我在这个论坛上的第一篇文章,尽管十多年来就深入探索了Stackoverflow。直到现在,我一直设法通过在Stackoverflow,其他论坛,文档中找到解决方案来解决问题。上面的所有链接都没有帮助。

谁能帮我吗? 此致

I'm stuck on a problem when uploading the completed app bundle to the Google Play console. After download, I get this message:
"The app cannot declare different versions of Google Play services depending on the device configuration. The following versions were found: [0, 12451000]"

The app displays a bottom Smart Banner (Google Ads), uses network and apart from algorithmic, it does not do much more.

build.gradle:

ext {
    version = '1.0'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.6.21'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0-alpha09'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle:app:

plugins {
    id 'kotlin-android'
    id 'org.jetbrains.kotlin.kapt'
    id 'com.android.application'
}

android {
    ...
    signingConfigs {
        debug {
            ...
        }
        release {
            ...
        }
    }
    compileSdk 32
    buildToolsVersion '30.0.3'
    defaultConfig {
        minSdk 19
        targetSdk 32
        versionName '1.0'
        versionCode 100
        multiDexEnabled true
        ...
    }

    buildFeatures {
        //noinspection DataBindingWithoutKapt
        dataBinding true
        viewBinding true
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
        }
        beta {
            applicationIdSuffix ".beta"
            versionNameSuffix "-beta"
        }
        release {
            applicationIdSuffix ".release"
            versionNameSuffix "-release"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility "11"
        targetCompatibility "11"
    }
    kotlinOptions {
        jvmTarget = "11"
    }
    ndkVersion '25.0.8221429 rc2'
    flavorDimensions "level"
    productFlavors {
        free {
            ...
            dimension "level"
            versionCode 100
            versionName "1.0"
            targetSdk 32
            minSdk 19
            signingConfig signingConfigs.release
        }
        pro {
            ...
            dimension "level"
            versionCode 100
            versionName "1.0"
            targetSdk 32
            minSdk 19
            signingConfig signingConfigs.release
        }
    }
    sourceSets {
        free {
            java { srcDirs 'src/free/java' }
            res { srcDirs 'src/free/res' }
        }
        pro {
            java { srcDirs 'src/pro/java' }
            res { srcDirs 'src/pro/res' }
        }
    }
    lint {
        checkReleaseBuilds false
    }
    dependenciesInfo {
        includeInApk true
        includeInBundle true
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1-native-mt'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1-native-mt'
    implementation 'androidx.appcompat:appcompat:1.6.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'io.reactivex.rxjava3:rxjava:3.1.4'
    implementation 'com.google.android.gms:play-services-ads:20.6.0'
    implementation 'com.android.support:multidex:1.0.3'
}
task wrapper(type: Wrapper) {
    gradleVersion = '7.3'
}

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="MissingLeanbackLauncher">

    <!-- Need to listen to UDP datagrams -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- For Android S devices & GMA SDK version 20.3.0 or lower -->
    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

    <!-- Support Android TV and do not require a touchscreen -->
    <uses-feature
        android:name="android.software.leanback"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/MyTheme.Blue.SplashScreen">
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="<APP_KEY>" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <activity
            android:name=".ActivitySplash"
            android:exported="true"
            android:theme="@style/MyTheme.Blue.SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Preference activity -->
        <activity
            android:name=".ActivityMain"
            android:exported="true"
            android:theme="@style/MyTheme.Blue.SplashScreen">
        </activity>
    </application>

</manifest>

The link related to that problem that I have reviewed:

Different versions of Google Play services cannot be declared depending on the device configuration

The app cannot declare different versions of Google Play services depending on the device configuration

Different versions of Google Play services cannot be declared depending on the device configuration

https://issuetracker.google.com/issues/223240936#comment21

https://issuetracker.google.com/issues/223240936

What I've done:

  • dig into the Gradle documentation to have a better understanding (plugins, implementation). To be honest, I've never done this job as it's always worked with a basic Gradle I just adapted. It was an opportunity to adjust many inconsistencies (may still remain some though).
  • request Google developer support (no answer yet)
  • of course: clean project, invalidate cash

But I'm still totally stuck. I have no clue whatsoever how I can solve this issue.

It's my first post on this forum although intensively exploring the stackoverflow since more than a decade. I've always managed to solve issues by finding solutions on stackoverflow, other forums, docs... until now. All the links above were of no help.

Can anyone help me out?
Best regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

满天都是小星星 2025-01-30 19:07:49

编辑:该错误现在已经修复了,现在即使使用7.3.0-*

目前有一个使用Android Gradle插件7.3.0-Alphaxx的应用程序中的错误。如果您将其恢复到7.2 0直到修复为止,这将取消阻止您。

Edit: The bug has now been fixed, things should now just work even with 7.3.0-*

There is currently a bug in Play Console with apps built with Android Gradle plugin 7.3.0-alphaXX. If you revert to 7.2 0 until this is fixed, this should unblock you.

说不完的你爱 2025-01-30 19:07:49

好的,问题(SSSSSS)似乎解决了。主要关键是@pierre在弹跳Android gradle插件上的建议7.0.6-alpha06替换为com.android.tool.tools.build:Gradle:7.2.0-rc01(+或 - epsilon)对于版本)。显然,它在上传到Google Play游戏机时,在上述多个版本的Google Play上解决了最初的问题。
在大多数情况下,我丢失了gradle,库包括 + build.gradle语法,与默默无闻的错误消息相关联。作为开发人员,我们确切知道我们导入了哪些库,我们选择哪些版本以及原因。我们吗?好吧,不,除了确切的情况下,我们大多数人都没有(从开发人员到经理)。我们的100%重点是我们的应用:功能,图像,性能,数据库,算法,客户体验... IDE和Gradle只是到达那里的手段,而不是目标。
Gradle是那种可做所有事情的真实工具,即使您的早晨咖啡是由出色的工程师构想的。但这不是最终用户/开发人员的指导。我不想了解Gradle的整个钟声和耳语,我只想通过我的项目开发。
我建议一组可以重复使用和调整的各种项目的样本,而不是只有几个项目相关的广泛参考文档。
我可以说,我遇到以下错误的Google Play控制台:

  1. 版本代码XXX已经使用。尝试其他版本代码。:只需增加您的代码版本(Integer Format)
  2. 您的APK或Android App Bundle需要具有软件包名称xx.xxxxxxxxxxxx.free.release :您混合在其中 您的Android App Bundle的应用程序/变体/口味前缀
  3. 使用错误的键签名。:用不同的键上传几次时抛出。然后,您必须找出哪个控制台“选择” ...
  4. 签署Android App Bundle。
  5. 未 Google Play服务的服务,具体取决于设备配置。找到以下版本:[0,12451000] :Gradle 7.0.6-Alpha06库中的错误
    同样,许多人感谢@pierre都让我度过难关。

Ok, problem(sssssss) seem solved. The major key was the suggestion of @Pierre on the buggy Android Gradle plugin 7.0.6-alpha06 to replace by com.android.tools.build:gradle:7.2.0-rc01 (+ or - Epsilon for the version). It apparently solves the initial issue on the said multiple versions of Google Play when uploading to the Google Play Console.
Most of the time I've lost resides in the Gradle and library includes + build.gradle syntax, associated with the obscur error messages. We, as developers, know exactly what libraries we import, what versions we choose and why. Do we? Well, NO, the large majority of us don't (from the developer to the manager), except in precise cases. Our 100% focus is our app: features, images, performance, database, algorithm, customer experience... The IDE and Gradle are just a means to get there, not an objective.
Gradle is that genious tool that does everything, even your morning coffee conceived by brilliant engineers. But it's not end user/developer oriented. I don't want to understand the entire bells and whisles of Gradle, I just want to get through my project development.
I would suggest a set of sample for various types of projects that can be reused and adjusted, rather than those extensive reference docs in which only a couple of items are relevant.
I could say the same for the Google Play Console on which I encounter the following errors:

  1. Version code xxx has already been used. Try another version code.: just increase your code version (integer format)
  2. Your APK or Android App Bundle needs to have the package name xx.xxxxxxx.free.release: you mixed up in the app/variant/flavours prefixes somewhere
  3. Your Android App Bundle is signed with the wrong key.: thrown when uploading several times with different keys. You then have to find out which one the console "chose"...
  4. The Android App Bundle was not signed.: means you try to upload a Debug flagged bundle
  5. The app cannot declare different versions of Google Play services depending on the device configuration. The following versions were found: [0, 12451000]: bug in gradle 7.0.6-alpha06 library
    Again, many thank's to @Pierre both for getting me through.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文