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
I have ant version 1.9.2 . and android version 17. I have build.xml file .
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 .
I am doing like
1) sdk/tools/android update project -t 3 -p
2) ant clean release
3) jarsigner -keystore -storepass -keypass
4) sdk/tools/zipalign -v 4 /bin/.apk
Check this following developer link
http://developer.android.com/tools/building/building-cmdline.html
Be sure that you have a file named
local.properties
in the root directory (i.e. same directory as yourbuild.xml
).Be sure that this file contains a line like this:
(Of course you need to adapt the path to your effective sdk location)
Double-check that the path is correct.
Re-run
ant debug
Note : the file local.properties is local (and is usually not under version control !)
Use this example You need to pass
sdk.dir
into ant, i.e.ant -Dsdk.dir=<path to Android SDK>
You'll also need to specify one of the seven or so Android build targets because the default build target is 'help'.
If you just run
ant -Dsdk.dir=<path to Android SDK>
, you'll get some help output, like so:BUILD SUCCESSFUL Total time: 7 seconds To build the APK, you have to specify debug or release.
This will help you creating an apk file