Google play says: “You need to use a different pac

2020-02-12 03:46发布

I have already published an app called com.mycompany.mygame on google play.

I then decided to publish an ad free version of it. I did not change the package name in eclipse because I noticed that in the "export" process you have the opportunity to have the final apk set as anything you like. So I set it there as com.mycompany.mygameaf - note the additional "af" on the end. But then when tried to upload it to the market, google said:

You need to use a different package name because "com.mycompany.mygame" is already used by one of your other applications

So now I'm confused. Is the complaint because I'm not allowed to have an apk that is a name which is and extension of a previous app? Or does the final apk somehow have knowledge of what the original name was?

What is the easiest way to resolve this?

标签: android
6条回答
倾城 Initia
2楼-- · 2020-02-12 03:56

The package name in the manifest is used to identify the application within Android and within Google Play. So different apps need different names.

The easiest workaround might be to just create a new package, with no code in it, and use that as the app's package name in the manifest.

What I've done to solve my many-apps-from-one-codebase problem is put all the apps' code in a library project, and then I have several app projects that use that library. The app projects contain no code, just a manifest and custom resources.

查看更多
狗以群分
3楼-- · 2020-02-12 04:06

Regardless of the name of the .apk file, the package name of the Application contents inside it must be unique.

You can use refactor-rename to change this, though make sure that the change penetrates to the manifest file, proguard configuration, etc.

查看更多
够拽才男人
4楼-- · 2020-02-12 04:09

The filename of the APK is irrelevant, the package name of your app is used as a unique identifier - it is in the root element in the AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.example.packagename"
   android:versionCode="1"
   android:versionName="1.0" >

When you initially create your project in Eclipse it creates an actual package structure which matches this package name for you to put your source files in.

You can actually chnage your package name by modifiying this manifest value and you can just keep the folder/package structure as is - it does not need to match your actual application package name.

Alternatively, right click your project in Eclipse, go to "Android Tools" and then select "Rename Application Package"

After you do this you should be able to submit your binary

查看更多
混吃等死
5楼-- · 2020-02-12 04:10

As mentioned in other answers, you're development would be simpler if you put all the shared code and assets a common library project that is a dependency of your paid and free versions.

You may also wish to play with the new Gradle build system (in Android Studio) which allows you to dynamically set things like the package name at runtime. It also allows you to switch resources during build time, which is extremely convenient; You could have a boolean resource that represents whether the current app is the paid version. This allows you to enable/disable app features based on a check to that value.

查看更多
乱世女痞
6楼-- · 2020-02-12 04:13

The name of the APK doesn't matter, its the package name within the AndroidManifest file that counts.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.yourcompany.yourapp"

There can only be one app on the market with that package name so in order to publish your ad free version you would have to change the package name in the manifest file, e.g. add the af onto the end of the package name within your manifest.

查看更多
爷、活的狠高调
7楼-- · 2020-02-12 04:15

Apart from correcting app name in the Manifest I also had to change applicationId in the app's gradle.build file.

 defaultConfig {
    applicationId "com.example.changednameofmyapp"
    ...
}

Also, if you're using ProGuard, do not forget to change appropriate rules in your proguard-rules.pro

Just search the old package name in the whole project and change it.

查看更多
登录 后发表回答