android - 具有相同包名的两个不同项目

标签 android google-play

我开发了一个 Android 项目,项目名称为 DemoMessageing,包名称为 com.abc.xyz,并将 FCM 添加到该项目作为在 Firebase 中创建的项目,包名称为 com.abc.xyz 用于云消息传递,应用 SHA-1 并下载了 google -服务.json。将该 .json 放入我的应用程序中。我在 Google Play 上上传了那个项目,也上传了更新。

现在我在 Firebase 中创建了新项目,包名与 com.abc.xyz 相同,但项目名称与 DemoMessageingTest 不同。从旧项目 DemoMessageing 中删除了 SHA-1)并在 Firebase 的新项目(DemoMessageingTest)中应用了相同的 SHA-1。下载新的 google-service.json 并放入我的应用中。

现在我创建了签名的 apk 并尝试上传到 google play 作为现有项目的更新。但是谷歌游戏给出了错误:

enter image description here

我增加了代码版本并再次尝试在 google play 上上传该应用程序。但是有同样的错误。

我的build.gradle如下:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 27
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.abc.xyz"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 8
        versionName "8"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process
        preDexLibraries = false //delete the already predexed libraries
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support.constraint:constraint-layout:1.1.0'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.whereismytransport.transportapisdk:transportapisdk:1.0.1', {
        exclude group: 'org.json', module: 'json'
    }
    compile('com.twitter.sdk.android:twitter:3.1.1@aar') {
        transitive = true
    }
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.google.android.gms:play-services-auth:10.2.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:recyclerview-v7:27.1.1'
    compile 'com.google.android.gms:play-services:10.2.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.squareup.picasso:picasso:2.4.0'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
        transitive = true;
    }
    compile project(':commonwidget')
    compile project(':common')
    compile project(':panowidget')
    compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
    compile project(':emojilib')
    compile files('libs/commons-lang-2.5.jar')
    compile 'com.amazonaws:aws-android-sdk-core:2.2.13'
    compile 'com.amazonaws:aws-android-sdk-s3:2.2.13'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.13'
}
apply plugin: 'com.google.gms.google-services'

我不明白我错过了什么,或者我做的对不对。

请用您的建议和经验指导我。

最佳答案

错误消息会告诉您确切的错误是什么。

You need to use a different version code for your APK or Android App Bundle because you already have one with version code 7

您之前上传的版本代码为 7 的 APK。如果您保留相同的包名称,则当您上传新的 APK 时,您就是在向用户发送更新。发生更新时,版本代码必须在您的应用程序中增加。增加您的应用版本代码(例如到 8),重建您的 APK,APK 应该可以正常上传。

关于android - 具有相同包名的两个不同项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52510149/

相关文章:

android - 更改 Android Play/Market 中现有应用的过滤器和要求的副作用

android - App compat主题的弹出菜单分隔符

Android ListView选择问题

java - MVVM 设计模式是否强制 ViewModel 和 View 具有 Observable 和 Observer 关系?

android - 我可以在 Google Play 中重新提交相同版本的应用吗?

android - 谷歌播放 : Your device is incompatible with this version -> "No Carrier"

android - 无法将已签名的 APK 上传到 PlayStore

java - 自定义 Facebook 登录以与 MethodChannel 一起使用

android - 撰写中的条件导航,无需单击

android - Google Play App Signing 在 Play 商店发布应用时出现错误