Developing android application with sdk and apache ant
developing android application with sdk and apache ant
ps: just a note to record the settings.
I hate eclipse! I seldomly used eclipse to develop android app. Here is a alternative approach to work with android sdk instead of eclipse!
Simply, there are two steps to finish configuration of development environment.
Firstly,download and install the android 2.2 sdk.
from
[1]http://androidappdocs.appspot.com/sdk/index.html
[2]http://www.android.com/
for example, http://dl.google.com/android/android-sdk_r06-linux_86.tgz
exact android-sdk_r06-linux_86.tgz to some place (i.e., /home/android/android/android-sdk_r06-linux_86), and then setup the system environment:
$ export PATH="$PATH:home/android/android/android-sdk_r06-linux_86/tools"
strongly recommend that it's added into .profile/.bashrc (to myself, I prefer to do this in /etc/environment, Ubuntu 9.04)
And then run the follow command at current console to download the sdk packages:
$ android
It will popup a new window manager ("Android SDK and AVD Manager"), click "Available Pacages" on the left column, and then the right column would show you "Sites, Packages and Archives"; let the checkbox selected (https://dl-ssl.google.com/android/repository/repository.xml), and then choose the package level which you want to install. Follow the tips and update sdk platforms.
This will take some time to updating, depengding on the packages you choose.
After updating platforms, run the following comand:
$ android list target
If upgrading sucessfully, you would see the targets you choosed.
Secondly, download and install apache ant
Ant's homepae: http://ant.apache.org
The lastest version is 1.8.1
exact the tarball into some place, /home/android/ant-1.8.1, for example. And then setup ant's path:
$ export PATH="$PATH:/home/android/ant-1.8.1/bin"
To make ANT work correctly, make sure to setup the JAVA_HOME first:
$ export JAVA_HOME=path/to/java
run
$ ant
at the currnt sonsole, you will see some error as follows:
lenovo@h180 /home/android $ ant
Buildfile: build.xml does not exist!
Build failed
To verify both above work correctly, now we create a new simple android project and compile it.
$ android create project -n HelloAnt -t android-8 -p HelloAnt -k exam.helloant -a HelloAnt
$ cd HelleAnt
$ ant debug
If the emulator or device is online, you could run directly:
$ ant install
to compile the project and install the .apk file into the emulator or device.
Until now everything is going well. Have fun!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论