Developing Android-aware tools

Source: Internet
Author: User
Tags sqlite database

Program development is sometimes very dependent on the use of development tools, a good complete development tools can make the developer's productivity significantly improved. The same is true for Android, which may be inseparable from the tools of Eclipse or Android studio, but they are actually integrated development environments (Integrated development environment, IDE), Integrate many tools into one, with visual interface and keyboard shortcuts to find and use.

Sometimes, however, there are too many tools to be integrated, often confusing and easy to forget about a tool. This article will talk about some of the tools that you can use with Android development and debug, which can be turned on using an eclipse or Android studio with the Android SDK installed to find the appropriate menu and buttons. But considering that the IDE is too slow to open in many cases, consider using commands to start them alone at the terminal.

If Android Studio is installed, these tools can be found in their installation packages, such as Under Mac, which are saved under the /Applications/Android Studio.app/sdk/tools path. If you are using eclipse, you will need to manually download the stand-alone Android SDK, which can be found in the Tools folder below.

Android

This tool will be called Android also shows that it should be the highest status, indeed its features include the Management SDK (software Development Kit) and AVD (Android Virtual Device), As well as creating and updating project used by development. You can see its basic usage through android-h .

       usage:android [Global Options] action [Action options] Global options:-H--help:help on a SP  Ecific command.     -V--verbose:verbose mode, shows errors, warnings and all messages.  --clear-cache:clear the SDK Manager repository manifest cache.                                                                    -S--silent:silent mode, shows errors only.                                                                    Valid actions                                                                    is composed                                                                    of a verb                                                                    and an optional Direct object:-sdk:displays The SDK manager window.-avd:displays the AVD manager window.-list   : Lists existing targets or virtual devices.-list avd:lists existing Android virtual devices.- List target:lists existing targets.-list device:lists existing devices.-list sdk:lists Remote SDK repository.-Create avd:creates a new Android Virtual device.-move avd:moves or rename S an android virtual device.-delete avd:deletes an android virtual device.-update avd:updates an A Ndroid Virtual Device to match the folders of a new sdk.-create project:creates a new Andro ID project.-update project:updates an Android project (must already has an androidmanifest  . xml).-Create Test-project:creates a new Android project for a test package.-update test-project:updates the Android Project for a test packAge (must already has an androidmanifest.xml).-Create Lib-project:creates a new Android Librar Y project.-update lib-project:updates an Android library project (must already has an ANDROIDM  Anifest.xml).-Create uitest-project:creates a new UI test project.-update adb:updates adb to support the USB Devices declared in the SDK add-ons.-update sdk:updates the SDK by suggesting new plat Forms to install if available.
Android SDK

There are no compiler tools in the new SDK package, and Android programmers know that there are many versions of Android, which are designed and programmed for the version when they are developed. android sdkcommand to run a visual management window, allowing users to select the desired version of Android to download so they can use the API on it. You can also download the corresponding API source for easy learning.
(You can sdk also open the SDK Management window without parameters, directly using android directives.) )

In this interface, you can also choose to update the SDK tool, which is the tool mentioned in this article, to the latest version. If you accidentally update the SDK version that is not yet compatible with the current development, you cannot drop the version here, only to download the old version at night, and then copy to the previously mentioned SDK file to overwrite the existing Tools folder.

Android AVD

Developing an Android program must have a device to do the testing. The best is to crack the physical device with administrator privileges, if not, a common physical device that can open the Developer option is also available. Because the physical device is running at its best (as long as it's not an old Android phone that's almost eliminated by the market), the effect is closer to the real user experience. If there is no physical device to do development, it can only be returned to the virtual device.

The android AVD directive opens the virtual Device Manager for easy creation and modification of Android virtual devices for development testing. Prior to this, however, it was necessary to use the SDK Manager to download the associated API version of the device image in order to create a specific version of the virtual device.

After all, the virtual appliance is borrowing resources on the computer so it is relatively slow to run. But there are several benefits of using virtual appliances: Don't worry about the device without electricity, you can project it when you do a presentation, you can create a device with different API versions and screen sizes, and you don't need to spend a lot of money buying all kinds of devices .

Other features

Android commands can also be used to create an Android project and then compile with ant or Gradle, so you can completely detach from the IDE. However, in most cases, you will prefer to use the IDE to create, after all, the visual interface will be more convenient. Sometimes you might want to deploy to other devices or develop projects that can use these scripts to create one-click.

DDMS

This tool is also extremely important, using frequencies much higher than Android. Most Android is used to initialize the configuration, and Ddms is indispensable in the debug process. It can see the thread information that the program uses, the network usage, can be profiling to see the time that method used the most resources.

In Eclipse and Android studio has been well integrated logcat content display, in the IDE can also directly by clicking on the exception of the entry to jump to the corresponding error file of the specified line, it is very convenient, so generally do not separate in the terminal to open the interface.

Dmtracedump

This directive is less commonly used, mainly by processing the trace file generated by profiling into an image file that shows the invocation relationship between the methods. In addition to looking cool, it is difficult to find out much useful value directly from the graph.

Uiautomatorviewer

This tool seems to me to be an artifact, and it can show the layout of the view and its size in the face screen. This allows you to resize the XML file to rearrange the layout. But more often, I use it to find the ID of the view and then reverse the ID to find the corresponding XML file.

This tool is not limited to viewing its own app, it can show anything on the screen. So you can use it to see what other people's apps use for the view to present is also good, such as to see if they are using a ListView or Relativelayout, with a button or TextView plus click events.

Some limitations are that it does not support viewing custom views, only system-defined type names are displayed. In addition, if you use canvas and OpenGL to draw content, you can not see its specific details. But it is also useful to know that others are drawing on their own, not simply combining several system views.

TraceView

This tool is also used to open the trace file generated by profiling, but it is far more useful than it is dmtracedump . traceviewlists the events used by each method call, and the expansion method can also see the percentage of time that the method has been called by other methods. This allows you to know that the method uses the most resources, which can then be optimized or removed from the main thread.

Monitor

Having said so many tools and monitor tools, I feel that it is a waste of time to say so much, because as long as this one can contain all the previously described tools. Additional features are available, such as uiautomatorviewer viewing only one screen layout at a time, but using monitor capture generates separate files to see the difference. Can only say the front just for the various tools to do the function, really need to use when just open monitor it.

Similarly it can open the trace file parsing method call time spent.

Other emulator

Use emulator -avd <name> the command to start a virtual device of a given name, but it is usually opened by the AVD manager. However, if a virtual device is used frequently, it is very convenient to open it with this. If you can't remember your name, you can android list avd check it out.

Monkeyrunner

This instruction can run some scripts to simulate how a atavistic user is using the developed application wildly, and it is good to do some stress testing with it. If you do not want to write scripts, you can also directly use the Monkey command under the ADB to do similar tests.

Sqlite3

Android defaults to a database with SQLite, and the SDK also provides a clean and clear API to create and access SQLite database files. The database files exist under the/data/data/<app-packagename>/databases path of the device, and each app has its own folder where the database files are saved. The SDK tool also comes with this sqlite3 tool to help programmers who prefer to view SQLite files using a terminal to Access database files.

However, I seldom use this tool because I have to extract instructions from the SQLite database file device adb pull to the computer. For ordinary devices, the SQLite database file is mentioned because of a lack of operational permissions. For cracked entity devices with administrator privileges or virtual simulators, they have instructions on the device that sqlite3 can be adb shell manipulated directly. The main reason is that I'm still used to seeing this data with a visual program.

Mksdcard

This tool provides a fake sdcard for Android virtual devices to provide the storage capacity of the device. Multiple devices can also share a file created by this tool as long as they don't start using it at the same time.

When you run these tools at the terminal, you can add the commands at the end of the instruction to & run behind them so that you can open multiple tools at the same time in one terminal. To learn more about the latest Android tools, you can browse the official Android Web site, as well as the Android Tools Project site website, and videos on Android tools introduced on Google IO over the years.

In addition to these tools, Android has a more powerful tool that is adb , but it is more like an instruction without a visual interface. And it adb has moved from the Tools folder to Platform-tools. Before you have an article the way to see the activity stack through it, there are more articles to describe it in detail.

References:
    1. SDK Tools | Android Developers
    2. Managing Projects from the Command line | Android Developers
    3. Updating SDK from command-line–android Tools Project Site
    4. Using DDMS | Android Developers
    5. Android:how to use Dmtracedump–stack Overflow
    6. Google I/O 2014–what ' s New in Android development tools–youtube
    7. Google I/O 2011:android development tools–youtube

Developing Android-aware tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.