简体   繁体   中英

how to generate apk using ant

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.

but when i am running this command it is returning error that " Target "debug" does not exist in the project"

Then you did not create your Android project properly, or you modified your build.xml file, or something else is broken.

As a test, I just ran the following command from my /tmp directory on Linux:

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

I then changed into the Foo directory and ran ant debug . The app compiled, and in my bin/ directory is Foo-debug.apk .

If you are not getting this sort of result, delete your build.xml file and run android update project --path ... , where ... is the path to your project, to create a fresh build.xml file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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