2

i want to know how can we generate apk file using ant script. i came to know that we can use "ant debug" command to do that.but when i am running this command it is returning error that " Target "debug" does not exist in the project". i am using ant1.7.0.is it the issue?i have tried given below code to generate apk.

 <target depends="build-subprojects,build-project" name="build">
    <jar destfile="bin/test.apk" basedir="bin/classes" >
  <manifest>
    <attribute name="Main-Class" value="test.Main" />
  </manifest>
</jar>
    </target>

but the generated apk is different from auto generated apk while build the app using eclipse.Please guide me.

4

1 回答 1

1

但是当我运行此命令时,它返回错误“项目中不存在目标”调试“

然后你没有正确创建你的 Android 项目,或者你修改了你的build.xml文件,或者其他东西被破坏了。

作为测试,我刚刚从我/tmp的 Linux 目录中运行了以下命令:

android create project --target android-17 --path Foo --package com.foo --activity Foo

然后我切换到Foo目录并运行ant debug. 该应用程序已编译,并且在我的bin/目录中是Foo-debug.apk.

如果您没有得到这种结果,请删除您的build.xml文件并运行android update project --path ...(项目路径在哪里...)来创建一个新build.xml文件。

于 2013-02-20T14:07:34.000 回答