如何在命令行中创建apk文件? [英] How to create apk file in command line?

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

问题描述

我使用 eclipse ide 来构建 apk 文件.现在我想在 linux 的命令行中创建 apk 文件.但是当我说 ant debug 时,它给出了以下错误:

I was using eclipse ide to build apk file . Now i want to create apk file in command line in linux. But when i say ant debug it gives following error :

Unable to obtain resource from anttasks.jar
  java.util.zip.ZipException : error in opening zip file

Problem : failed to create task or type checkenv 
Cause : The name is undefined 
Action : Check the spelling
Action : Check that any custom tasks/types have been declared
Action : Check that any <presetdef>/<macrodef> declarations have taken place

我有蚂蚁版本 1.9.2 .和安卓版本 17.我有 build.xml 文件.

I have ant version 1.9.2 . and android version 17. I have build.xml file .

我将我的 ant 版本更改为 1.8.0,但无论我做什么,我仍然遇到那些无法创建任务或键入 checkenv 错误的问题.

Edit : I changed my ant version into 1.8.0 , But whatever i do still i am getting those failed to create task or type checkenv error .

推荐答案

确保在根目录(即与 build.properties 相同的目录)中有一个名为 local.properties 的文件.xml).

Be sure that you have a file named local.properties in the root directory (i.e. same directory as your build.xml).

确保该文件包含如下一行:

Be sure that this file contains a line like this:

sdk.dir=c:\\tools\\android-sdk

(当然你需要根据你的有效sdk位置调整路径)

(Of course you need to adapt the path to your effective sdk location)

再次检查路径是否正确.

Double-check that the path is correct.

重新运行ant debug

注意:文件 local.properties 是本地的(通常不受版本控制!)

Note : the file local.properties is local (and is usually not under version control !)

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

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