What android must know

Source: Internet
Author: User
Tags time and date

1. Description of important packages:
Android. app: provides high-level program models and basic runtime Environments
Android. Content: contains various classes for accessing and publishing device data.
Android. Database: browses and operates databases through content providers
Android. Graphics: The underlying graphics library, including canvas, Color Filtering, vertices, and rectangles, which can be directly drawn to the screen.
Android. Location: class for locating and Related Services
Android. Media: Provides media interfaces for managing multiple types of audio and video.
Android.net: class that provides network access assistance, exceeding the normal java.net. * interface
Android. OS: Provides system services, message transmission, and IPC Mechanisms.
Android. OpenGL: Provides OpenGL tools.
Android. provider: provides a class to access Android content providers.
Android. Telephony: provides API Interaction Related to dialing.
Android. View: provides a basic user interface framework.
Android. util: a tool-based method, such as time and date operations.
Android. WebKit: default browser operation interface
Android. Widget: contains various UI elements (mostly visible) used on the application Screen
Ii. Virtual Machine Dalvik
The primary difference between Dalvik and the standard Java Virtual Machine (JVM) Is that Dalvik is based on registers while JVM is based on stacks. Register-based virtual machines take less time to compile larger programs.
The difference between the Dalvik and the Java Runtime Environment is that Dalvik is optimized to allow instances of multiple virtual machines to run simultaneously in a limited memory, and each Dalvik application is executed as an independent Linux Process. Independent processes can prevent all programs from being shut down when the Virtual Machine crashes.
3. Android-Related File Types
Java file-application source file
A considerable part of Android is written in Java (the blue part in the basic shelving diagram is developed in Java), and Android applications must be developed in Java.
Class file ------ target file after Java Compilation
Unlike j2se, Java can be directly compiled into a class, and class files on the Android platform cannot be directly run on Android. Because Google uses its own Dalvik to run the application, the class here certainly cannot be run in the androiddalvik Java environment. The Android class file is actually only the intermediate target file in the compilation process, you need to link to the DEX file before running on Dalvik.
Dex file ----- executable files on the Android platform
The bytecode file format supported by the android Virtual Machine Dalvik is defined by Google on the newly released Android platform using its own Dalvik Virtual Machine. Such virtual machines do not execute Java bytecode, it is another bytecode: Dex format. After compiling Java code, you can use tools on the Android platform to convert Java bytecode into Dex bytecode.
APK file ------- Installation File on Android
APK is the extension of the android installation package. An android installation package contains all files related to an Android Application. In the APK file, compress the androidmanifest. xml file, application code (. Dex file), resource file, and other files into a compressed package. A project can only input a .apk file.
4. Applications
Take helloworld as an example. The compiled class file is stored in/bin/OMS/samples/home. The compiled APK is in the binfile and can be opened with WinRAR. The organizational structure is similar to that of a project.
The running environment description. classpath content is:

The project configuration file. project content is:

Homeapidemoactivity

Com. Android. Ide. Eclipse. ADT. resourcemanagerbuilder

Com. Android. Ide. Eclipse. ADT. precompilerbuilder

Org. Eclipse. jdt. Core. javabuilder

Com. Android. Ide. Eclipse. ADT. apkbuilder

Com. Android. Ide. Eclipse. ADT. androidnature
Org. Eclipse. jdt. Core. javanature

V. debugging
ADB function operations:
? Quickly update the code in a device or mobile phone simulator, such as an application or Android system upgrade.
? Run shell commands on the device
? Manage ports on devices or mobile phone Simulators
? Copy and paste files on devices or mobile phone Simulators
Common ADB operations:
Install the application to the simulator
ADB install app.apk
Android does not provide a command to uninstall an application, but can only be manually deleted:
ADB Shell
CD Data/APP
Rm app.apk
Enter the shell of the device or Simulator
ADB Shell
With the preceding commands, you can enter the shell environment of the device or simulator. In this Linux Shell, You can execute various Linux commands,
ADB shell [command]
In addition, if you only want to execute a shell command, you can use the following method:
Example: ADB shell dmesg
The kernel debugging information is printed.
Release Port
You can set any port number as the request port from the host to the simulator or device. For example:
ADB forward TCP: 5555 TCP: 8000
Copy a file
A file can be copied to a device or from a device.
? Copy a file or directory to the device or simulator:
ADB push
For example:
ADB push test.txt/tmp/test.txt
? Copy a file or directory from a device or Simulator
ADB pull
For example:
ADB pull/Android/lib/libwebcore. OS
Search/Wait For simulators and device instances
ADB Devices
Obtains the list of currently running simulators, device instances, and the status of each instance | waiting for a running Device
ADB wait-for-Device
View bug reports
ADB bugreport
Record wireless communication logs
ADB Shell
Logcat-B radio
There are many wireless communication logs and there is no need to record them during operation. You can use the command to set the record to get the device ID and serial number.
ADB get-Product
ADB get-serialno
Access Database sqlite3
ADB Shell
Sqlite3

Related Article

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.