简体   繁体   English

如何更改包名称,不蚀

[英]How to change package name, without eclipse

I want to change the package name com.blah.blah to something different, but I don't want to use eclipse because it says I have errors when I don't, and doesn't build. 我想将包名称com.blah.blah更改为其他名称,但是我不想使用eclipse,因为它表示我在不使用时也出错,并且无法构建。

I was checking to do it using APKtool, by changing the manifest.xml, and the package values in each smalis. 我正在检查是否使用APKtool通过更改manifest.xml和每个smalis中的包值来做到这一点。 I looked if there was any more, and there wasn't. 我看是否还有更多,没有。

It may sound foolish, but I really need it, because this app I want to run two copies of the same app. 听起来可能很愚蠢,但是我真的很需要它,因为我想运行同一应用程序的两个副本。 I've seen people doing this with apps that are blocked often, such as gameguardian and gamecih (Memory Hacking programs). 我见过人们使用经常被阻止的应用程序来执行此操作,例如gameguardian和gamecih(内存黑客程序)。

Thanks! 谢谢!

BY THE WAY: this question hasn't been asked before as long as i'm concerned, and most of the similar ones required using eclipse. 顺便说一句:我一直没有问过这个问题,大多数类似的问题都需要使用eclipse。

If i am not mistaken you can do it by: 如果我没记错的话,可以通过以下方法做到:

Workspace>Project>.project 工作区>项目> .project

Change the name in content. 更改内容名称。

Changing the package name of an application you will have to: 更改应用程序的程序包名称,您将必须:

  • Modify the package name in the manifest 修改清单中的软件包名称
  • Change the packages of all your Activities, Services and BroadcastReceivers you have declared in your manifest without specifying their fully qualified names. 更改清单中声明的​​所有“活动”,“服务”和“广播接收器”的程序包,而不指定其完全限定的名称。 that is: 那是:

    <activity android:name=".LoginActivity">

    Must have its package changed, whilst: 必须更改其包装,同时:

    <activity android:name="com.example.LoginActivity">

    Can stay with the initial package. 可以保留初始包装。

  • I recommend also to change the application name, so that you will be able to distinguish between the two applications while using the application as Android user. 我还建议更改应用程序名称,以便在以Android用户身份使用该应用程序时能够区分这两个应用程序。

NOTE : Note that if you change the package of all the classes included in the application project structure all together you risk you might change the packages of some objects that would require further modification in the code. 注意 :请注意,如果一起更改应用程序项目结构中包含的所有类的包,则可能会冒风险,您可能会更改某些对象的包,而这些对象需要在代码中进行进一步修改。 Eg if you change the package of custom widget you will need to change the hardcoded package in the xml files that refer to it also. 例如,如果您更改自定义窗口小部件的程序包,则将需要在也引用它的xml文件中更改硬编码的程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM