如何修改和重新发布AOSP应用程序?

如何修改和重新发布AOSP应用程序?

问题描述:

我对库存的android电子邮件应用程序中缺少一个简单功能感到恼火.由于此应用程序是作为开放源代码发布的,因此我可以很容易地解决此问题.

I'm annoyed by a simple feature lack in the stock android email application. As this application is released as open source I can fix this quite easily.

问题:如何以我和其他用户可以安装修改后的EMail应用程序(没有root访问权限)的方式发布此修改?我尝试了以下方法:

Question: How can I release this modification in such a way that me and other users can install the modified EMail application (without root access)? I tried the following:

  1. 通过大量复制,我能够使用标准的Eclipse/ant工具链来构建电子邮件应用程序,而无需使用make-scripts的ASOP工具链来构建电子邮件应用程序.
  2. 安装此应用程序现在会导致错误,因为该软件包已安装(显然,并且我没有要更新的演唱键)
  3. 禁用设备上的电子邮件应用程序也无济于事,我仍然无法安装新的应用程序.

尽管我要在清单中更改应用程序的程序包名称,但这并不是那么简单:您还必须将所有类都移到新程序包中.此外,正如您在 AndroidManifest 中看到的那样,该应用程序定义了新权限(com.android.email.permission.READ_ATTACHMENT)和其他导致在安装修改后的程序包时导致重复错误的内容.这些权限是源中作为字符串的引用.

I though about changing the package name of the application in the manifest, but it is not that simple: You also have to move all classes into the new package. Additionally, as you can see in the AndroidManifest, the application defines new permissions (com.android.email.permission.READ_ATTACHMENT) and other things which lead to duplication errors when installing the modified package. These permissions are references as strings in the source.

是手动修改每个文件然后调试每个错误真的是解决我的问题的唯一方法吗?这些修改还会使我很难修改和移动每个文件,因此很难拉入电子邮件应用程序的新版本.

Is modifining every file by hand and then debugging every error really the only solution to my problem? These modifications would also make pulling in new versions of the EMail application very difficult as I have modified and move every file.

我虽然要更改清单中应用程序的程序包名称

I though about changing the package name of the application in the manifest

这将是必需的.

您还必须将所有类移至新程序包中

You also have to move all classes into the new package

不一定. R将生成到清单中声明的​​包中,因此您需要安排导入该R类.并且您将需要更新清单本身,以使用完全限定的类名,而不是裸类名(如果适用).

Not necessarily. R will be generated into the package declared in the manifest, and so you will need to arrange to import that R class. And you will need to update the manifest itself to use fully-qualified class names instead of bare class names, if applicable.

此外,正如您在AndroidManifest中看到的那样,该应用程序定义了新权限(com.android.email.permission.READ_ATTACHMENT)以及其他在安装修改后的程序包时导致重复错误的内容.

Additionally, as you can see in the AndroidManifest, the application defines new permissions (com.android.email.permission.READ_ATTACHMENT) and other things which lead to duplication errors when installing the modified package.

完全有可能定义一个现有权限.我不知道您在哪里/如何出现复制错误".

It is entirely possible to define an existing permission. I have no idea where/how you are getting "duplication errors".

是手动修改每个文件然后调试每个错误真的是解决我的问题的唯一方法吗?

Is modifining every file by hand and then debugging every error really the only solution to my problem?

或多或少.请参见上面的不一定"段落.

More or less. See the "not necessarily" paragraph above.

这些修改还会使我很难修改和移动每个文件,因此很难引入EMail应用程序的新版本.

These modifications would also make pulling in new versions of the EMail application very difficult as I have modified and move every file.

您是决定执行此任务的人,而不是将更改提交给现有的开源邮件应用程序,例如K-9 Mail(几年前也分叉了AOSP Email应用程序)或AOSP电子邮件应用程序本身(通过 AOSP贡献过程).

You were the one who decided to embark on this quest, as opposed to contributing your changes to an existing open source mail app, such as K-9 Mail (which also forked the AOSP Email app, years ago), or the AOSP Email app itself (via the AOSP contribution process).