如何从命令行编译APK? [英] How to compile APK from command line?

查看:366
本文介绍了如何从命令行编译APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的需求使得Android应用程序。根据客户的要求,我的网站会送我一个JSON文件直接到我在Delphi中创建一个Windows应用程序。这其中将文件保存的Andr​​oid应用程序源文件夹中,然后执行一个命令行告诉了Android编译生成APK文件,并将其发送给我的客户,都认为没有我的presence。

I am interested in making Android apps on demand. Depending on the clients request, my web site would send me a JSON file direct to a Windows application that I have created in Delphi. This one would save the file inside the Android app source folder and then, execute a command line telling the Android compiler to generate the APK file and send it to my client, all that without my presence.

Android的项目是做与 MOTODEV 。它采用了Android SDK,它是我的根。

The Android project was made with MotoDev. And it uses the Android SDK that is in my root.

如何配置命令行从里面我的Delphi程序实现这一目标?

How should I configure the command line to achieve this from inside my Delphi program?

我还需要改变清单把一个新的版本号,因此它不会与其他客户端版本冲突。

I will also need to change the manifest to put a new version number so it does not conflict with other clients version.

推荐答案

Android使用Ant构建系统,这样你就可以创建一个的build.xml build.properties 文件为您的项目。

Android uses the Ant build system, so you can create a build.xml and build.properties file for your project.

您需要创建的build.xml 文件的第不过:

You'll need to create the build.xml file first though:

android update project -p .

这将生成一个的build.xml 文件。你或许应该自定义生成步骤和目标,为您的项目。你的情况一个很好的想法是让你的网站为特定生成的 build.properties 文件生成...然后通过包括它的的build.xml 文件。特别是,你需要指定的 build.properties 文件,其中的签名密钥是,什么密码是:

This will generate a build.xml file. You should probably customize the build steps and targets for your project. A good idea in your case would be to have the build.properties file generated by your website for the specific build... Then include it via the build.xml file. In particular, you will need to specify in the build.properties file where the signing keys are, and what the password is:

Build.Properties:

key.store=keystore.dat
key.alias=signing_key
key.store.password=password123
key.alias.password=password123

使用的构建过程蚂蚁还允许你做变量替换的Java文件,这可能是另一种思路。这将允许你通过客户端基础上进一步在客户端上自定义生成过程。

The build process using ant also allows you to do variable replacements in Java files, which might be another idea. It would allow you to customize the build process further on a client by client basis.

在默认情况下,构建由触发:

By default, the build is triggered by:

ant clean
ant release

另外一个不错的主意:通过放置一个&LT有蚂蚁副本生成的APK文件由网站访问的网络共享;副本... /> &LT线;目标名称=放与GT; 部分。

这篇关于如何从命令行编译APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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