Android study notes (1)

Starting today we start to learn about Android:

1.0 Android Basic Getting Started Tutorial

1. Android background and current situation

The Android system was created by Andy Rubin and later acquired by Google; the earliest version is: Android 1.1 and the latest version is 5.28 this year, Android M launched at the Google I/O conference. Interestingly, the names of the Android systems are all named after dim sum. The following table is the name of 15 Android versions, corresponding to the API number and release time!

System version name API version number release time
Android 1.5: Cupcake: Cupcake 3 2009.4.30
Android 1.6: Donut: Donut 4 2009.9.15
Android 2.0/2.0.1/2.1: Eclair: Muffin 5/6/7 2009.10.26
Android 2.2/2.2.1: Froyo: Frozen Yogurt 8 2010.5.20
Android 2.3: Gingerbread: Gingerbread 9 2010.12.7
Android 3.0: Honeycomb: Honeycomb 11 2011.2.2
Android 3.1: Honeycomb: Honeycomb 12 2011.5.11
Android 3.2: Honeycomb: Honeycomb 13 2011.7.13
Android 4.0: Ice Cream Sandwich: Ice Cream Sandwich 14 2011.10.19
Android 4.1: Jelly Bean: Jelly Bean 16 2012.6.28
Android 4.2: Jelly Bean: Jelly Bean 17 2012.10.30
Android 4.3: Jelly Bean: Jelly Bean 18 2013.7.25
Android 4.4: KitKat: Kit Kat 19 2013.11.01
Android 5.0: Lollipop: Lollipop 21 2014.10.16
Android M: Preview 22 2015.5.28

 

Well, in addition to the above public versions, there are of course some other versions. As of 2015.1, the market share of each version is as follows:

 After reading the above information, we may have such a question: With so many system versions, which version should we develop for? This is the "fragmentation" problem of Android that Android must face, and this problem is divided into two parts: ① System fragmentation: When we develop apps, we may need to be compatible with low versions, for example, the minimum compatibility is 2.3 versions; inch, 5.0 inch, 5.3 inch... etc. In addition to mobile phones, there are also Android tablets, so we may have to deal with this screen adaptation problem during development. Of course, we don't need to consider these complicated things when we are just learning. We will go into it later in the actual development!

2. Android system features and platform architecture

System Features:

  • The application framework supports the reuse and replacement of components (when the app is released, the framework agreement is complied with, and other apps can also use the module)
  • Dalvik virtual machine: optimized for mobile devices - integrated browser: open source WebKit engine
  • SQLite structured data storage
  • Optimized graphics library, multimedia support, GSM telephony, Bluetooth, etc.
  • Built with software layering

Platform architecture diagram:

A simple understanding of the architecture:

  1. Application (application layer)  We generally say that the development of the application layer is carried out at this level, of course including a set of built-in applications in the system, using the Java language
  2. Application Framework (application framework layer)  needs to use this layer regardless of the built-in system or the app we write ourselves. For example, if we want to blacklist incoming calls and hang up calls automatically, we need to use TelephonyManager. Through this layer, we can easily implement the hangup operation without caring about the underlying implementation.
  3. Libraries (library) + Android Runtime (Android Runtime)  Android provides us with a set of C/C++ libraries, which are used by different components of the platform, such as media frameworks; Android Runtime is composed of Android core library set + Dalvik virtual machine. The simple operation process is as follows: 

  4. The Linux kernel  here is related to the underlying drivers, some system services, such as security, memory management and process management, etc.

3. Summary of this section:

This section understands the historical background and current situation of Android, and then briefly analyzes the system characteristics and system architecture of Android. We only need to understand these conceptual things, and in the next section we will start to build the Android environment!

 

 

1.2 Development environment construction

Classification  Android Basic Getting Started Tutorial

The current mainstream Android development environments are: ①Eclipse + ADT + SDK ②Android Studio + SDK ③IntelliJ IDEA + SDK Now most developers in China still use Eclipse, but after Google announced that it will no longer update ADT, and the official website also removes the Eclipse download link that integrates the Android development environment, various phenomena indicate that developers will eventually transition to Android Studio. The open source projects are based on Android Studio! Of course, both development environments will be introduced in this tutorial, which one to use depends on yourself~ There is also IntelliJ, which is similar to Android Studio, and it will not be explained!

1. JDK installation and configuration

  • Step 1: Download JDK  You can go to the official website to download: Jdk official download  can also be downloaded from the author's network disk: the author's network disk  PS: This can be the next one, it doesn't matter much, 32-bit can only download 32-bit!

  • Step 2: JDK installation  is the next step for fools!

  • Step 3: Configuration of environment variables  The configuration of environment variables is for the convenience of our command line operations, which will be used later! Right click on My Computer --> Advanced --> Environment Variables 

     Create a new JAVA_HOME   to modify the PATH variable, don't delete the original things! ! ! !   Create a new CLASSPATH   to verify whether the environment configuration is complete  Open the cmd (command line) of the computer, enter cmd with win key + R, and then javac and java in the command line in sequence, the effect shown in the figure shows that the configuration is complete: 


2. Choose one of the two development tools

At the beginning, I also talked about the current situation of the development environment IDE. In addition, I forgot to say something earlier: Android Studio is relatively expensive to configure. If the computer is not very good, it is recommended to use Eclipse for Android development first. Let me first talk about the process of developing APPs that we are familiar with IDE. Follow the following process to get familiar with the use of IDE:

Then choose one of the following two to start our Android development road!

Eclipse + ADT + SDK: Android Studio + SDK:


3. Analysis of related terms

  1. Dalvik:  Android-specific virtual machine, different from JVM, Dalvik virtual machine is very suitable for use on mobile terminals!
  2. AVD:  (android virtual machine): Android virtual device, which is an Android emulator
  3. ADT:  (android development tools) Android development tools
  4. SDK: (software development kit) software development kit, which is a collection of tools for Android system, platform architecture, etc., such as adb.exe
  5. DDMS: (dalvik debug monitor service) Android debugging tool
  6. adb: Android debugging bridge, in the platform-tools directory of sdk, has many functions, and the command line is necessary
  7. DX tool: convert .class to .dex file
  8. AAPT: (android asset packing tool), Android resource packaging tool
  9. R.java file: automatically generated by the aapt tool according to the resource files in the App, which can be understood as a resource dictionary
  10. AndroidManifest.xml: app package name + component declaration + program compatible minimum version + required permissions and other program configuration files

The follow-up content may be a bit difficult for you as a beginner, but when you look back later, you will find that these things are very useful~ If you don’t understand, you can skip it first

4. Some commands of the ADB command line

Before executing the ADB command, we also need to configure the environment variable for our SDK.  Step 1: Create a new ANDROID_HOME environment variable, and paste the sdk root directory address: 

 Step 2: Update the Path environment variable, add at the beginning of Path: %ANDROID_HOME%\tools;  to complete the configuration, and then learn the instructions: 


5. APP program packaging and installation process:


6. APP installation process:

7. Summary of this section

In this section, we analyze the status quo of Android development IDE. It is recommended that beginners use Android Studio to develop Android APP if the hardware conditions permit. It describes the installation and configuration of JDK, the process of getting familiar with the IDE, the analysis of some key names, the common commands of the ADB command line, and finally the packaging and installation of the program and the analysis of the installation process! After this chapter, I believe that everyone has a simple understanding of Android development, the process of developing a program, and the corresponding project directory structure! I believe that everyone will complain that the emulator AVD runs very slowly. In the next section, I will introduce an Android emulator that is faster than the real machine - the installation and use of Genymotion!

 

1.2.2 Using Android Studio to develop Android APP

Classification  Android Basic Getting Started Tutorial

written in front

This section will introduce how to use Android Studio to develop Android APP, which is the same as the previous Eclipse + ADT + SDK to build an Android development environment. This section only introduces some basic things. In-depth, such as shortcut keys, tips, etc. will be introduced in detail in another article!

1. Download Android Studio


Official website download: Android Studio for Window ...  Baidu cloud download: android-studio-bundle-141.1903250-windows.exe


2. Install Android Studio

Just a fool's next step, just list the pages that need attention:

  


3. New construction

After the installation is complete, open our Android Studio. For the first start, you need to download the SDK and other things. It takes a long time. The author waited for about 40 minutes before the download was complete.

Select the first item and create a new Android project

Select which platform the development program will run on:

Choose the style of Activity:

Set some information about the Activity after entering a page of the program

Finish and then a long wait~


4. IDE interface analysis

Take a look at the entire interface first:

Then look at our project structure, and we generally only care about the app directory:


5. Run the program to try

Click the X in the menu bar to run the program:


6. Summary of this section

The usage of Android Studio is relatively simple. Of course, the author is just using Android Studio, and I will write a more in-depth article later. Here, everyone is thinking about it. For the time being, you can run the program, know where to write code, and how to read Logcat.

Guess you like

Origin blog.csdn.net/s_sos0/article/details/131037978