Basic tutorial for Android-1.2.1 use Eclipse + ADT + SDK to develop Android apps and androidadt
Android basics tutorial -- 1.2.1 use Eclipse + ADT + SDK to develop Android apps
Tags (separated by spaces): basic Android tutorial
1. Preface
Here we have two options: directly use the encapsulated ADT Bundle for Android development, or configure it by yourself.
Because Google has abandoned the ADT Update and the download link is also canceled on the official website. Here, Google will discard the latest version
ADT Bundle for download!
2. directly use the packaged Eclipse
32-bit edition:Adt-bundle-windows-x86-20140702.zip
64-bit edition:Adt-bundle-windows-x86_64-20140702.zip
Download and unzip the package, and then jump to 4. Create a Helloworld project!
3. Configure Eclipse + ADT + SDK by yourself
Eclipse can be downloaded from the Eclipse Official Website: Eclipse official download
The SDK and ADT can be downloaded from AndroidDevTools: official website of AndroidDevTools
Here we provide a lot of Android development-related tools, and do not need to go over the wall, necessary development site! Mark!
There may be some problems with different versions of Configuration! The author uses the old version (very old) and can download the required version:
Eclipse: eclipse-jee-helios-win32.zip
ADT: ADT-15.0.0.zip
SDK: android-sdk-windows.rar
Construction Process:
1. Decompress Eclipse:Find eclipse.exe in the folder to run the program. After running the program, set the storage location of the project code (workspace)
2. ADT Configuration:Click the menu bar in sequence:Help->Install new software->Add->Local...->Select the ADT folder after downloading and Pressurization->Accept->Restart Eclipse->Check whether a small Android icon is displayed in the menu bar.If yes, the installation is complete.
PS: A waring may occur during this period, which is ignored directly ~
3. decompress the SDK Configuration:Click the menu bar in sequence:Windows->Rreferences->Android->Select the decompressed SDK package->OK->Enable reverification
4. Create an AVD (Android simulator ):Click the menu bar in sequence:Cell phone icons->New->Select system version->Skin screen resolution->Set the SD card size->Complete->Start.!
PS:It may be slow to start AVD for the first time. You need to wait ~
4. Create and run the HelloWorld project of the first program
1. New-> Android App Project
If you cannot find it, you can go to Other-> android to find it. The same is true:
2. Enter the project information in sequence:
3. Run the created Program
4. view the running effect from the simulator:
5. project directory structure analysis
Let's take a look at our project directory diagram:
What we need to know next is:
- Src directory:Contains all the program code files required by the App. Most of the time, we write our Java code here.
- Gen directory:Focus only on R. java file, which is automatically generated by ADT. It defines an R class and can be seen as an id (resource number) dictionary, including the user interface, graphics, string and other resource IDs. Resources are usually called through the R file. The Compiler also looks at the resource list, and unused resources are not compiled, space saving for apps
- Assets Directory:Store resources without generating resource IDs in the R. java file. You need to use the AssetsManager class for access.
- Libs directory:Store some jar packages, such as v4, v7 compatible packages, or third-party packages.
- Res resource directory:For storing resources, drawable: Stores image resources; layout: stores layout files on the interface, all of which are XML files;
Values: A description file containing parameters in XML format, such as a string. xml string, color. xml color, and style. xml.
- AndroidManifest. xml configuration file:The control file of the system is used to tell the Android App some basic information, such as components, resources, required permissions, and compatible sdks of the lowest version.
6. Several common views
On the menu bar, choose Windows> show view to open the corresponding view:
Click other. The following are some common views in Android:
In fact, we mainly use Logcat because, unlike Java, our App runs on a virtual machine, while our console does not display the relevant information, only the installation status, so we will view the program running log information on Logcat:
7. Summary In this section
In this section, we learned how to use Eclipse to build our Android development environment. Both the lazy version and the hands-on version can be used;
Next, 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 learn about the code!
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.