Google Play upload problem: “Your Android App Bundle needs to have the package name com.x.x.base”

非 Y 不嫁゛ 提交于 2020-08-06 13:58:11

问题


I am trying to upload an application under development to Google Play Console, internal testing track. The application has two flavor dimensions and and two dynamic features, the last two being resources only (no code). I am relying on Android Studio to generate the directory structure and the signed bundle.

The name of the package is com.something.something. The upload fails with the message "Your APK or Android App Bundle needs to have the package name com.something.something.base."

I cannot track down the source of the problem, though it looks like it should have something to do with the flavor dimensions. On the other hand, I had no problem uploading a single apk, without the dynamic features.

I am not sure which part of the code is relevant here, which is probably part of my problem, but my main build gradle looks like this

apply plugin: 'com.android.application'

android {

    compileSdkVersion 27
    defaultConfig {
        applicationId 'com.something.something'
        ....
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            //testCoverageEnabled false
        }
    }

    flavorDimensions "version"
    productFlavors {
        small {
            dimension "version"
        }
        full {
            dimension "version"
        }
    }

    dynamicFeatures = [":feat1", ":feat2"]

}

dependencies {
    ...
}

I do not want to burden the question with irrelevant code, but can provide more if there is some intuition about where the problem might be.

I would be grateful for any suggestion on how to approach the debugging here. (Uploading is painfully slow, trial and error is not much of an option.)


回答1:


Since your problem is not related to codes, try changing your package name to something else, something more "unique". com.myname.myappname is an example. In this case you need to change everything related to your package name. Try it and report back




回答2:


Thank you all for taking a shot at the answer. Here is what I learned about this issue and how I "solved" it.

My problem starts with Google Play Console (GPC) insisting that an app name be associated with the very first package name you have uploaded. This is in addition to having one app = one package name rule. If you are still in the draft stage, you can delete the package from your "All applications" list in GPC, and upload a package with different name, but once it's published - no such luck. The way GPC is designed, all my future uploads should have the suffix ".base", if this is what my first upload had.

Next, Android Studio (AS), does something called manifest file merging. (@Fantômas, your audience may not be as omniscient as you are - the behavior of AS is relevant here, and with your permission I would return the tag.) When you choose the flavor for the bundle, the name of the flavor is suffixed to create the package name in the merged AndroidManifest file, irrespective of the name you specify in your main AndroidManifest.xml, as you can check if you choose to "analyze" (the name of the link after the bundle is generated) newly created bundle:

Thus, in my first upload I had a flavor called base, and I did not realize that AS tacked it as the suffix on the name of my package. From that point on, GPC will not take a package for my app by any other name.

One thing that is irrelevant here are dynamic features - they just happened to be part of my second upload attempt.

I have asked Google to delete my app so I can start from scratch.




回答3:


You do not need to delete your app from Google console. Simply open Build.gradle(Module:app) in your android studio and change the Application Id to the name google is requesting from you.



来源:https://stackoverflow.com/questions/57648188/google-play-upload-problem-your-android-app-bundle-needs-to-have-the-package-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!