开发者

how to start Android example project from command-line?

I dislike using Eclipse and wish to start an example Android project from the command-line, how can i do this? Is there a way to use "android create project" command to automatically pull in example code from the SDK? A similar metho开发者_Go百科d to the following perhaps?

android create project --package com.example.helloandroid \
--activity HelloAndroid \
--target 1 \
--path HelloAndroid


Here is an example how to build and run ApiDemos sample project.

  1. Go to your SDK folder, then to ../samples/android-#/ApiDemos, where # is API Level.
  2. Start terminal in this folder.
  3. Run android list targets and find target with API Level that is equal or higher then what you've chosen for # on step 1. Lets call this target X. In my case X equals 21. It looks like in your case X equals 1.
  4. Run android update project -p . -n ApiDemos -t X (change X to correct value)
  5. Run ant debug
  6. Run adb install bin/ApiDemos-debug.apk

For Step 6 to succeed you need to connect your device to computer via USB. Make sure you've checked Setting->Applications->Development->USB Debugging. Also you can verify that adb can see your device running adb devices in the terminal.

Now sample project is built and installed on your device.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜