Develop Android APP using Eclipse + ADT + SDK
1. Preface
We have two options here, directly use the encapsulated ADT Bundle for Android development, or configure it yourself Because Google has given up the update of ADT, and the download link has been canceled on the official website, here is the latest version before Google gave up the update. ADT Bundle is available for everyone to download!
2. Use the packaged Eclipse directly
32-bit version: adt-bundle-windows-x86-20140702.zip64-bit version :adt-bundle-windows-x86_64-20140702.zip Download and unzip, then jump directly to 4. to create a Helloworld project!
3. Configure Eclipse + ADT + SDK yourself
Eclipse can be downloaded from the Eclipse official website: Eclipse official download and SDK and ADT can be downloaded from AndroidDevTools: AndroidDevTools official website here. It provides a lot of tools related to Android development, and there is no need to circumvent the firewall. It is a must-have development website! Be sure to mark! There may be some problems between different version configurations! The author is using an old version (very old), and you can download it if you need it: Eclipse: eclipse-jee-helios-win32.zipADT: ADT-15.0.0.zipSDK: android-sdk-windows.rarBuilding process: 1. Unzip Eclipse: Go to the unzipped folder and find eclipse. exe runs, and after running, set the storage location (work space) of the project code2.ADT configuration:Click the menu bar in sequence:help -> Install new software -> Add -> Local... ->Select the folder to download the compressed ADT ->accept -> warning, just ignore it~3.SDK decompression configuration:Click the menu bar in sequence:windows -> Rreferences -> Android - >Select the decompressed SDK package -> OK ->Open re-verification4. Create AVD (Android emulator):Click the menu bar in turn: Mobile phone icon -> New -> Selected system version -> Skin screen resolution ->Set the SD card size -> Complete -> start! PS:It may be very slow to start AVD for the first time, you need to wait~4. Creation and operation of the first program HelloWorld project1.New -> Android App ProjectIf you can’t find it, you can go to Other -> android to find it, the same thing:
##2. Then enter the project information in sequence:
3. Run the created program
4. See the running effect from the simulator:
5. Analysis of the directory structure of the project
Let’s look at it first Below is our project directory diagram:
The next part we need to know:
src directory : Contains all the program code files required by the App. Most of the time we write our Java code here
gen directory: only Pay attention to the R.java file. It is automatically generated by ADT. It defines an R class, which can be regarded as a dictionary of id (resource number), including the id of user interface, graphics, strings and other resources. We usually The resources used are also called through R files. At the same time, the compiler will also look at this resource list. Unused resources will not be compiled in, which can save space for the App
assets directory: Stores resources, and resource ids will not be generated under the R.java file. You need to use the AssetsManager class to access
libs directory: Store some jar packages, such as v4, v7 compatibility packages, or some third-party packages
res resource directory: stores resources, drawable: storage Image resources; layout: layout files that store the interface, all XML files; values: Description file containing parameters using XML format, such as string.xml string, color.xml color, style.xml style style, etc.
AndroidManifest.xml configuration file : System control file, used to tell the Android system some basic information contained in the App, such as components, resources, required permissions, and the minimum compatible version of the SDK, etc.
6. Several commonly used views
Click on the menu bar: Windows -> show view to open the corresponding view:
Click other, the following are some commonly used views in Android:
In fact, the main thing is the use of Logcat, because unlike Java, our App runs in a virtual machine on, but our console does not display relevant information, only the installation status, so we will check the log information of the program running on Logcat:
7. Summary of this section
In this section we learned to use Eclipse to build our Android development environment, both the lazy version and the hands-on version are available; Then we introduced some information about the directory structure of the Android project developed by Eclipse. In the next section, we will go deep into the HelloWorld project and understand the code!