“限制com.example" Google Play错误;即使更改程序包名称 [英] "com.example restricted" Google Play error; even when changing the package name

查看:303
本文介绍了“限制com.example" Google Play错误;即使更改程序包名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我去了从Android Studio发布我的第一个android应用程序.当我上传到Google Play时,出现此错误:

I went to publish my first android app from Android Studio. When I went to upload to Google Play, I got this error:

上传失败:由于"com.example"受到限制,您需要使用其他软件包名称.

Upload failed: You need to use a different package name because "com.example" is restricted.

重命名程序包名称时,它仍然给我错误消息.我尝试制作一个新程序包并将所有内容移至该程序包,但错误仍然存​​在.我已经删除了com.example软件包的所有痕迹.我还确保将Android Manifest.xml更改为新软件包.

When I renamed the package name, it still gave me the error message. I tried making a new package and moving everything to that, but the error still persists. I've deleted any trace of the com.example package. I also made sure to change the Android Manifest.xml to the new package.

唯一仍然显示旧软件包名称的是BuildConfig.java,它包含以下行,其后是我的旧软件包名称的其余部分:

The only thing that still says the old package name is the BuildConfig.java, which contains this line followed by the rest of my old package name:

public static final String PACKAGE_NAME = "com.example"

如果有人可以帮助我并回答这篇文章,我将不胜感激.我正在使用Ubuntu Linux 14.04.1.

If someone can please help me and answer to this post, I would greatly appreciate it. I'm using Ubuntu Linux 14.04.1.

推荐答案

这与Android Gradle插件中的最新更改有关,该更改将应用​​程序的标识符与Java包名称分开.

This is related to a recent change in the Android Gradle plugin that split the application's identifier from the Java package name.

Android使用该应用程序的标识符来标识您的应用程序.它也用作Play商店网址中的标识符.通常,但并不总是与Java包名称相同.

The application's identifier is used by Android to identify your application. It is also used as the identifier in the Play Store's URLs. This is often, but not always the same as the Java package name.

从Gradle插件的0.11版本开始,使用applicationId设置在build.gradle中设置应用程序ID,如下所示:

As of version 0.11 of the Gradle Plugin, the application ID is set in your build.gradle using the applicationId setting like so:

android {
    defaultConfig {
        applicationId "com.yourdomain.yourapp"
    }
}

设置此项应该可以解决您的问题.

Setting this should clear up your issue.

开发者控制台中的错误消息可能只是未更改以反映新术语.

The error message in the developer console likely just hasn't changed to reflect the new terminology.

从Gradle插件版本0.11开始发行说明:

From the Gradle Plugin version 0.11 release notes:

0.11中用户可见的变化之一是我们已弃用了 packageName和packageNameSuffix设置,并将它们重命名为 applicationId和applicationIdSuffix.这样做的目的是使 很明显,此应用程序ID已与程序包分离 清单中的声明,尤其是R类和 BuildConfig类以及应用程序内的所有实现类, 可以自由重命名和重构;你只需要保持 applicationId相同.如果打开build.gradle文件,则lint为 突出显示这些已弃用的呼叫并提供要更新的快速修复程序 他们.

One of the user visible changes in 0.11 is that we've deprecated the packageName and packageNameSuffix settings, and have renamed them to applicationId and applicationIdSuffix. The purpose of this is to make it clear that this application id is decoupled from package declarations in your manifest, and in particular, the R class and the BuildConfig class, and all the implementation classes inside your app, can be renamed and refactored freely; you just need to keep applicationId the same. If you open your build.gradle file, lint is highlighting these deprecated calls and offering quickfixes to update them.

这篇关于“限制com.example" Google Play错误;即使更改程序包名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆