简体   繁体   English

如何以编程方式创建android项目?

[英]how to create an android project programmatically?

I'm working on an eclipse plugin that needs to offer the option of creating a new Android Project from a given apk. 我正在开发一个eclipse插件,该插件需要提供从给定apk创建新Android项目的选项。 I basically want to use the information from the AndroidManifest.xml in the apk to do the project setup. 我基本上想使用apk中AndroidManifest.xml中的信息来进行项目设置。

Basically the steps I want to follow are: 基本上,我要遵循的步骤是:

  1. unpack the apk using apktool 使用apktool解压缩apk
  2. create Android project using some information from the unpacked apk. 使用解压后的apk中的一些信息创建Android项目。

I have done this successfully doing both steps manually (as idicated in http://codebangers.com/?p=584 ) 我已经成功地手动完成了两个步骤(如http://codebangers.com/?p=584所示

However, now I'd like to automate the process and do it programmatically. 但是,现在我想自动化该过程并以编程方式进行。 I was able to do step 1. programmatically. 我能够以编程方式执行步骤1。

Regarding step 2. I know the eclipse ADT plugin provides a NewProjectCreator class, however it seems I should not use this class to create the project since the class helps says: 关于第2步。我知道eclipse ADT插件提供了NewProjectCreator类,但是由于该类有助于说明,因此我似乎不应该使用此类来创建项目。

  /**
   * The actual project creator invoked from the New Project Wizard
   * <p/>
   * Note: this class is public so that it can be accessed from unit tests.
   * It is however an internal class. Its API may change without notice.
   * It should semantically be considered as a private final class.
   */

Does anybody know what is the correct way of programmatically creating an Android project? 有谁知道以编程方式创建Android项目的正确方法是什么?

Not sure if that is possible for security seasons, however you could change the extension of the apk towards a zip file. 不确定在安全季节是否可行,但是您可以将apk的扩展名更改为zip文件。 If you open the zip file you could see the application code/resources 如果打开zip文件,则可以看到应用程序代码/资源

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

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