官术网_书友最值得收藏!

Running Android applications

When it comes to running Android applications, we get to choose between using a real device (phone or tablet) and an emulator Android Virtual Device (AVD) as the target. Both have their advantages and drawbacks. While Android devices offer the complete experience at full speed, their disadvantages include the following:

  • Slower to start. Loading an application onto an AVD is generally faster, decreasing debugging times.
  • Limited access, with the root account unavailable on Android devices unless you enable it in the firmware. Full access to the device's filesystem is disabled, including application data.

AVDs do not have these disadvantages, but they have the following limitations:

  • They are slow: Even when using the Intel Atom images and having Intel's HAXM virtualization add-on installed, any device handily beats an AVD
  • Lack of OpenGL ES support: While OpenGL ES support is experimentally being added, it's still unstable and, of course, so slow that it is unsuitable for any serious application
  • Lack of microphone support: At the time of writing this book, it's not possible to use a system microphone with an AVD
  • No motion sensors: We can only test portrait and landscape modes
  • No light sensor or LED:
  • No compass, GPS, and so on: These can be faked, however, by setting GPS coordinates in the AVD

Beyond these differences, devices and AVDs are quite similar. Which one to use depends largely on your needs. However, any verification and non-simple debugging should, as a rule of thumb, always be done on a device. While an AVD approaches the functionality of a real device, it is still so different and limited that its results should not be relied upon as real device behavior.

That said, both can be used in an identical fashion with ADB, or the Android Debug Bridge. ADB is a client-server program that consists of a server running on the Android device or AVD, and a client running on the system accessing it. The ADB client can either be run as a command-line tool or be used from within an IDE such as Eclipse for purposes such as uploading applications to the Android device or AVD, uploading and downloading files, and viewing system and application logs in real time.

Especially the ability to view logs in real time for any running application is very helpful to us when we try to debug an application, as we can output any debug messages to the log.

主站蜘蛛池模板: 碌曲县| 旺苍县| 平利县| 舟曲县| 远安县| 桑日县| 五台县| 凤冈县| 基隆市| 巨鹿县| 穆棱市| 宜春市| 丹阳市| 武义县| 东海县| 尚志市| 黑龙江省| 南宫市| 禄劝| 银川市| 大方县| 清流县| 称多县| 昆山市| 斗六市| 郁南县| 卢湾区| 金昌市| 鹿邑县| 饶河县| 巩义市| 曲阳县| 当涂县| 鸡西市| 古田县| 定西市| 赤水市| 瑞金市| 敦化市| 新兴县| 阜宁县|