Developing android application with sdk and apache ant

发布于 2022-09-19 16:26:07 字数 3874 浏览 21 评论 0

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文