Android's underlying knowledge

Source: Internet
Author: User
Tags time and date
I. Description of the IMPORTANT package:
Android.app: Provides a high-level program model and provides a basic operating environment
Android.content: Classes that contain various access to and publication of data on the device
Android.database: Browsing and manipulating databases through content providers
Android.graphics: The bottom of the graphics library, including canvas, color filtering, dots, rectangles, you can draw them directly to the screen.
Android.location: Classes for locating and related services
Android.media: Provides a number of classes to manage a variety of audio, video media interface
Android.net: Provides classes that help network access over the usual java.net.* interfaces
Android.os: Provides system service, message transmission, IPC mechanism
Android.opengl: A tool to provide OpenGL
Android.provider: Provides class access to Android content providers
Android.telephony: Provides API interaction associated with dialing calls
Android.view: Provides a basic interface framework for user interfaces
Android.util: A tool-related approach, such as a time and date operation
Android.webkit: Default Browser operator interface
Android.widget: Contains a variety of UI elements (mostly visible) used in the application's screen

Second, virtual machine Dalvik
The primary difference between Dalvik and standard Java virtual machines (JVMS) is that the Dalvik is based on registers and the JVM is based on stacks. Register based virtual machines for larger programs, it takes less time to compile them.

The difference between the Dalvik and the Java Runtime environment is that Dalvik is optimized to allow instances of multiple virtual machines to run concurrently in limited memory, and each Dalvik application executes as a stand-alone Linux process. Independent processes can prevent all programs from shutting down when a virtual machine crashes.

Iii. related file types for Android
Java files-----Application source files
Android itself is written in Java (basically the blue part of the architecture diagram is developed in Java), and the Android app has to be developed using Java.

Class file------Java-Compiled destination file
Unlike J2se,java, which is compiled into class, it can be run directly, and the class files on the Android platform cannot be run directly on Android. Because Google uses its own Dalvik to run apps, the class is certainly not running in Androiddalvik Java, and the Android class file is actually just an intermediate target file in the compilation process, and needs to be linked to Dex File to run on the Dalvik.

Dex file-----An executable file on the Android platform
Android virtual Machine Dalvik-supported bytecode file format Google uses its own Dalvik virtual machine on the newly released Android platform to define that the virtual machine does not execute Java bytecode, but rather another byte code: DEX-formatted bytecode. After compiling the Java code, the tools on the Android platform can be used to convert Java bytecode into Dex byte codes.

APK files-------installation files on Android
APK is an extension of the Android installation package, and an Android installation package contains all the files associated with an Android application. The apk file androidmanifest.xml files, application code (. dex files), resource files, and other files into a compressed package. A project can only be typed into a. apk file.

Iv. about Applications
Take HelloWorld as an example, the compiled class file, placed in the/bin/oms/samples/home. The compiled apk in bin file, can be opened with WinRAR, the structure of similar works.

Run environment description. Classpath content is:
<?xml version= "1.0" encoding= "UTF-8"?>
<classpath>
<classpathentry kind= "src" path= "src"/>
<classpathentry kind= "Con" path= "Com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind= "Con" path= "Org.eclipse.jdt.user_library/ophone"/>
<classpathentry kind= "Output" path= "Bin"/>
</classpath>

Project configuration file. Project content is:
<?xml version= "1.0" encoding= "UTF-8"?>
<projectDescription>
<name>HomeAPIDemoActivity</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>


Five, commissioning
ADB functional operations:
? Quickly update the code in the device or phone simulator, such as application or Android system upgrades
? To run the shell command on a device
? Manage a predetermined port on a device or cell phone simulator
? Copy and paste files on the device or cell phone simulator

ADB common operations:
Install apply to Simulator
ADB install app.apk

Android does not provide a command to uninstall the application and can only be removed manually:
ADB shell
CD Data/app
RM app.apk

A shell that enters a device or simulator
ADB shell
With the above command, you can enter the shell environment of the device or emulator, in which 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 methods:
such as: adb shell DMESG
Will print out debug information for the kernel
Publishing port
You can set any port number as the request port for the host to the emulator or device. Such as:
ADB forward tcp:5555 tcp:8000

Copying files
You can copy files to a device or from a device
? To copy a file or directory to a device or emulator:
ADB push
Such as:
ADB push test. Txt/tmp/test.txt

? To copy a file or directory from a device or emulator
ADB pull
Such as:
ADB Pull/android/lib/libwebcore.os
Search/wait simulator, device instance
ADB devices

Gets the list of instances of the currently running emulator, device, and the status of each instance | Waiting for a running device
ADB wait-for-device

View Bug reports
ADB bugreport

Record Wireless communication Log
ADB shell
Logcat-b Radio

The wireless communication log is so numerous that it is not necessary to record at run time, you can set the record to get the device ID and serial number by command
ADB get-product
ADB Get-serialno

accessing 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.