Android Note Development Prelude 1 development environment building and development tools use introduction

Source: Internet
Author: User

Reprint Please specify http://www.cnblogs.com/devtrees/p/4382234.html

Welcome to correct mistakes, common progress!

A background knowledge

Introduction of 1.1G-4G

Generation (Generation)

WAP (wait and pay)

Wireless Markup Language (WML) Lite version of the HTML language

Two. Android Overview

1.Android Operating System Introduction

Introduction to 2.Android History

3.Android system Architecture (emphasis)

First Layer: Application Layer Application

Second Layer: Application Framework Layer application framework (middleware)

Tier Three: Android bottom class library layer Libraries, Dalvik virtual machine

Layer Fourth: Linux kernel layer Linux kernel (security management, memory management, process management, power management, hardware drivers)

Android tries to run on the Linux kernel base.

4. Software stacks for mobile devices, including

A complete operating system

Middleware

Critical applications

5. Two different types of virtual machines (focus)

1), the structure is different: The JVM uses the stack schema, Dalvik uses the register, the data is loaded on the Cup register.

2). class file loaded by the JVM, Dalvik loads the. dex file, and optimizes the memory allocation.

Three. Introduction to the use of Android development environment building and development tools (i). Use of Sdkmanger

1. You can manage the download and uninstallation of the SDK version. (SDK download to platform folder)

2.ADT (Android Developer Tools) is a plugin for eclipse

3.

1) The downloaded package has:

Eclipse+adt Plugin---ADT plug-in;

Android SDK Tools---the SDK tool for Android

Android Platform-tools---Android's latest platform tool

The latest Android platform---the latest platform for Android

The latest Android System image for the emulator---the Latest emulator View object

2) After decompression, there are three files and an execution program.

The Eclipse folder is a tool for development.

The SDK folder is a tool set used for development.

SDK Manager.exe SDK's manager

4.

Note: The tools option in the SDK Manage has the options option, opens, hooks the first option in the Others tab, hooks up, and downloads the resources in HTTP, without being interrupted by the wall.

5.Android version and API level correspondence and Sdkmanager introduction

1) Relationship between Android version and API level

Platform API Level

Android2.2 8

Android2.3.3 10

Android4.0 14

Android4.1.2 16

Note: recommended in android2.2, 2.3, 4.1 platform development, stability.

2) Sdkmanager Introduction

"The development of which platform needs to develop the product, it is necessary to download the corresponding platform files." After the download is complete, the folder is in the Platform folder under the SDK folder. 】

Description of specific files under each Android version:

SDK Platform -the platform needed for development (important), the jar package used for development

Samples for SDK --sample code for SDK "sample code is downloaded and placed in the Samples folder in the SDK folder, which is based on the Android version number of the folder." 】

Arm EABI v7a System Im age--used to create an image of an ARM processor-based emulator

Intel x86 Atom System image --used to create an image of an x86 processor-based emulator

MIPS System Image -Open source processor architecture (not many) mirrors

Google APIs -When you use a map in development, you need to download the rack, and then you can manipulate Google Maps after downloading.

Sources for Android SDK --All the source code of the SDK, easy to debug, see how the system is implemented "will be placed in the SDK folder in the Sources folder in the Android version of the folder"

Extras --Additional tools

Android Support Library-supported libraries (can make the lower version support the high version), the API backwards-compatible, the development project will use

Google AdMob Ads SDK --for adding ads to completed programs

The Google analytics App Tracking SDK , which is used to analyze programs, is posted online and can be tracked through this area.

Google Cloud Messaging for Android Library – for message push

Google Play Services -a rack package that you want to send to Google after the program is finished

Google Play APK Exception Library --

Google Play Billing Library --

Google Play Licensing Library --

Google USB Driver --is the driver of the phone.

Google Web Driver --a driver for web cameras

Intel x86 Bmulator Accelerator (HAXM)--an accelerator tool provided by Intel Corporation

"Use: Find" Emulator accelerator "folder, open the executable file inside, the processor of this machine to I3 above"

(b). Introduction and creation of simulator

1. Simulator Size Create background

VGA 480* 640

QVGA 240*320

HVGA 320*480

WQVGA 240*400

FWVGA 480*854

WVGA 480*800

Note: The larger the simulator, the more complex the calculation, and the more resources it consumes.

2.AVD Creation (Avd:android virtual device for Android)

1) Two tabs, one is AVD, the following is shown, AVD creates a storage directory for device generated files

The other is device definitions (defined devices)

2) Create an emulator interface for each item meaning:

AVDname: emulator names;

Device: screen resolution;

Target: Platform version number;

Cpu/abi: Type of CUP (processor)

KeyBoard: Whether the keyboard is displayed when it is created;

Skin: When created, displays the skins on the keyboard

Front Camera:

Back canera: Control simulator camera,webcam0--> automatically load PC's camera

Memory Options:ram--> simulator RAM size

Internal Storage: How large is the hard drive of the simulator;

SDCard: The size of the external device (do not too much, is to create the same size file on the hard disk as the SD card)

Emulation Options:Snapshot---the equivalent of windows-7 sleep state, that is, after the shutdown, the next time the boot, these operations are still, not recommended to cause problems

Use Host GPU---If the computer is a discrete graphics card, you can make the picture smooth, if it is integrated graphics, it is easy to cause the picture to become flower

Note: 1. The emulator and the computer link its practical is the Adb.exe Debug Bridge (protocol communication)

2. The number in the upper left corner of the simulator is actually the port number of the simulator and also the phone number of the simulator (the simulator does not support Chinese)

3. Tips: Ctrl + F11 Toggle Screen

3. Common Error Creating Simulator:

1), invalid command-line parameter:

The illegal path of the error, which represents the installed path, is in Chinese. Add the "android_sdk_home" environment variable, pointing to the Android SDK directory. Then restart the avd--> simulator

2), after the simulator starts, cannot save the data

Cause: The computer shuts down unexpectedly or the simulator shuts down illegally.

Normally when the simulator is opened, it is generated in the "Documents and Settings\administrator\.android\avd\**.avd" directory: Cashe.img.lock, hardware-qemu.i Folders such as Ni.lock, Sdcard.img.lock, and Userdata-qemu.img.lock are used to mark the current emulator device to be turned on. These folders are automatically deleted when the emulator is closed.

Note: If the computer restarts unexpectedly or the emulator cannot be turned off, these files will not be deleted automatically, the system Android emulator is still open, the newly opened emulator will not be able to save the data. This time need to manually delete these folders "These files are used to indicate that these radial files were used by that simulator

PID file in folder Cashe.img.lock after the file is opened, it holds a PID value in the process, which is the process ID. When two identical simulators are turned on, some of the installed software is not saved.

3), "Network not registered" error message solution

A: The computer is not connected to the Internet, and there is no local area network; Network Neighborhood--Properties--local connection--Properties: Setting up TCP/IP:

IP Address: 192.168.1.100

Subnet mask: 255.255.255.0;

Default gateway: 192.168.1.100

Preferred DNS server: 192.168.1.100

B: There is no internet connection, but there is a local area network;

IP Address: Set to the IP of your local area network;

Subnet Mask: Set to the mask of your local area network;

Default gateway: Set the gateway to your local area network;

Preferred DNS server: Router IP set to your local area network

(iii). DDMS Introduction

1. Interpretation: Ddms:device Definition Motion Service

2.DDMS position

If eclipse does not have this entry in the upper right corner, then there is a small square similar to the field in this location, click, select Other, there will be a list, DDMS, select, press OK, you can.

3.DDMS interface

1) 1 Devices interface showing the devices currently connected to eclipse

2) There are several tabs in the interface at 2

Threads detects threads in a process for ease of debugging

The heap is an observation of the application's stack information

File Explorer lists the files directory structure of the currently selected Android device

Emulator Control simulates the currently selected Android device, which also has several options

Telephony Status: Phone status, example: Speed changes for mobile network signals.

Telephony actions: Phone action, you can call the simulator, send text messages

Example: Call is calling the simulator

Hang up is the simulator that hangs up the phone

Location Controls

Longitude (longitude), Latitude (latitude)

Four Introduction to the SDK directory

Add-ans: Extended Plugins, additional information

docs: Help documentation, frequently used

Extras: Additional directories, supported JAR packages

platforms: Platform Directory

platform-tools: Tools used in development. Contains

Adb.exe "Android Debug Bridge: Android Debug bridges, for debugging programs",

Aapt.exe "Application Package Tools: Android Program Packaging tool, complete the program to be packaged into a. apk file"

Dx.bat "Convert. Class bytecode files to. dex bytecode files because Android executes. Dex bytecode Files"

Samples: Sample Code

sources: source code Directory

system-images: Mirror Directory

temp: Cache file

Tools: The new simulator is usually placed under this folder, which also contains some tools:mksdcard.exe--> to create an SD card, that is, the emulator is running an SD card, this is the SD card in the hard disk. "Put some tools associated with the simulator."

(v) Common orders of the ADB and related issues

1.adb:android Debug Bridge: The Debug bridges for Android, for debugging programs

2. Common commands:

ADB devices List of all devices

Can list Android devices including the real machine, if the real machine does not show up, check two places: whether the driver of the real machine is installed and whether USB debugging is turned on

adb shell mounts to the Linux space remote access to the simulator terminal

#ls List Phone Files directory

#ps list The processes the phone is running on

#ping

adb kill-server Kill service

adb start-server Open Service

If you do not want to hit this command, you can first tap the ADB devices, the system will automatically open the service, and then retrieve

The adb install xxx.apk installs the application, the installation package can be dragged directly to the command Line window after the install.

If there are multiple devices, we can specify the device

ADB install–s emulator-5554 d:/xxx.apk

Otherwise it will error: Error:more than one device and emulator

adb Uninstall Com.itheima.helloworld (Package name, not the name displayed to the user)

adb pull <remote> <local> Copy the in-phone file to the computer first in the command line into the directory where you want to copy and then execute this statement first phone file (without path, direct file name plus extension) After copying the file name (also do not add path, direct file name plus extension)

adb push <local> <remote> Copy the files from your computer to your phone first in the command line into the directory you want to copy the file and then execute this statement first computer files (without the path, direct file name plus extension) After the copied path (root directory/plus parent directory) plus file name (filename plus extension)

Android Create Avd–name android2.2–target 8 Creating simulator

EMULATOR–AVD advname boot Simulator For example: EMULATOR–AVD 2.2 (2.2 for us to create a device name)

Mksdcard 20m d:/sdcard.img Create SDcard

3. Problems and Solutions

1) The ADB is written with a socket. And the socket itself is not stable, so when the network has a problem, or the port is occupied, the ADB will hang up, the socket has failed to bind.

Workaround 1:

In Ddms, the left side of the device has a inverted triangular small arrow, open, the list has an option: RESET adb. The role is to kill the ADB and restart.

Workaround 2:

In fact, the principle that DDMS does is this, we can also do this directly:

On the command line, type:adb kill-server

When we use the simulator, we will report this error:

ADB Connection Error remote host forced to close an existing connection

We need to enter at the command line: Theadb start-server service will restart.

However, if the service does not start, the Adb.exe process may not be responding, in Task Manager, in the Processes tab, locate the Adb.exe process and end the process.

If the discovery process does not end, the error appears: Can ' t find 5037, stating that there is an application software, 5037 this port number is occupied, enter on the command line:Netstat-ano List current port number occupancy

In this case, the external address is: The port number can be found by looking at the port number for 5037lai to see which PID, and then in the process manager through the PID, to see which application occupies, end the application, if it is eclipse occupied, belong to normal.

2) 360, pea pods and other third-party mobile phone helper applications will have the built-in Adb,eclipse will also be built into the ADB, so that when they run simultaneously will cause different adb to seize the same port, resulting in the ADB instability affecting our development. Just turn off the apps and services that stop these third-party phone assistants.

Android Note Development Prelude 1 development environment building and development tools use introduction

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.