从 com.example 更改 Eclipse Android 项目的默认包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13484833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change default package from com.example for Eclipse Android projects
提问by gone
I am using Eclipse 4.2 with Android SDK.
我正在将 Eclipse 4.2 与 Android SDK 一起使用。
I am wondering if it is possible to change the default package ID com.example
that shows in the "New Android Application" wizard as you type the application name?
我想知道是否可以com.example
在键入应用程序名称时更改“新建 Android 应用程序”向导中显示的默认包 ID ?
I would like it to default to my own package ID so that I don't need to correct the Package Name field each time.
我希望它默认为我自己的包 ID,这样我就不需要每次都更正包名称字段。
Is this possible to do? Please explain how.
这有可能吗?请解释如何。
回答by Tor Norbye
No, you cannot change the default; it's hardcoded in the plugin sources.
不,您不能更改默认值;它在插件源中硬编码。
(For the curious, it's in com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage#SAMPLE_PACKAGE_PREFIX in the ADT code base). We should consider persisting the most recently set package prefix and inserting the parent package next time. Feel free to file an issue for that at http://b.android.comcategory Component-Tools.
(出于好奇,它位于 ADT 代码库中的 com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage#SAMPLE_PACKAGE_PREFIX 中)。我们应该考虑持久化最近设置的包前缀,下次插入父包。请随时在http://b.android.com类别 Component-Tools 上提出问题。
-- Tor
-- Tor
回答by user2232952
With Android Studio not running, edit the file: C:\Users\MyAccount\.AndroidStudio\config\options\options.xml (replace C: with the installation drive and MyAccount with your account name).
在 Android Studio 未运行的情况下,编辑文件:C:\Users\MyAccount\.AndroidStudio\config\options\options.xml(将 C: 替换为安装驱动器,将 MyAccount 替换为您的帐户名)。
Within the xml file look for "property name="SAVED_COMPANY_DOMAIN" value=" and change the value to what you want.
在 xml 文件中查找“property name="SAVED_COMPANY_DOMAIN" value=" 并将值更改为您想要的值。
回答by Murillo Comino
Following user2232952's guidance, for new versions of Android Studio change the value of:
按照 user2232952 的指导,对于新版本的 Android Studio 更改以下值:
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
回答by dispake
If you've already created your project, you could go to your AndroidManifest.xml file and update the attribute in the Manifest (root) tag
如果您已经创建了项目,则可以转到 AndroidManifest.xml 文件并更新 Manifest (root) 标记中的属性
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="1.0" >
Just make sure the rest of your code also reflects this change.
只需确保您的其余代码也反映了此更改。
回答by acro
Click the package name and hit Alt+Shift+R and Rename, it will update everything!
单击包名称并按 Alt+Shift+R 并重命名,它将更新所有内容!