Reputation: 1430
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 .
Upvotes: 6
Views: 15553
Reputation: 28706
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
(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 !)
Upvotes: 1
Reputation: 482
Check this following developer link
http://developer.android.com/tools/building/building-cmdline.html
Upvotes: 1
Reputation: 28484
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
Upvotes: 0
Reputation: 15
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:
help:
[echo] Android Ant Build. Available targets:
[echo] help: Displays this help.
[echo] clean: Removes output files created by other targets.
[echo] compile: Compiles project's .java files into .class files.
[echo] debug: Builds the application and signs it with a debug key.
[echo] release: Builds the application. The generated apk file must be
[echo] signed before it is published.
[echo] install: Installs/reinstalls the debug package onto a running
[echo] emulator or device.
[echo] If the application was previously installed, the
[echo] signatures must match.
[echo] uninstall: Uninstalls the application from a running emulator or
[echo] device.
BUILD SUCCESSFUL Total time: 7 seconds To build the APK, you have to specify debug or release.
ant -Dsdk.dir=<path to Android SDK> debug
This will help you creating an apk file
Upvotes: 0