Android Developer Get started (i)

Source: Internet
Author: User
Tags android sdk manager

Note:

The original study of Android development summary, at that time written very meticulous, a lot of small things are written in, space is very large, it is suggested that students need to jump according to the directory.

Technology this thing updates quickly, some content may have a better solution or tool, here I no longer note. Please understand.

Reading objects

First Contact Java/android programming, hope to start java/android journey, but do not know, blankly at a loss, hope to get guidance and help and learning desire is strong enough and eventually want to become the top maintenance of Android system development engineer communication talent. Please open this book, I believe you will be able to answer many of your questions in the introductory study. Full of small white readers, the author's suggested reading order is read from beginning to end, and there are some basic but still lacking readers, please index the directory according to need, find the necessary knowledge to check the gaps. Do anything can have art in it, wish everyone in the road to become skilled Daniel happy! Let's enjoy this journey.

1. How to start from scratch?

To a truly completely small white (people who have not been programmed to touch much): Since you want to get started, at least go to the web to find out what Java is (an object-oriented, popular programming language), what Android is (an open source, an operating system used by a large number of mobile devices). Look just fine, don't ask to understand more in place deep, concept can.

Then, the Java Foundation must have, if not at all, first look at Mr. Rectification Editor's "Java Programming Fundamentals", Time is limited, at least read the first 1 to 8 chapters. A special reminder is that you have to practice while watching (the practice means knocking the code on the computer) with the book Code instance. Note: At first, you don't need to fantasize about your own creative transformation, completely knocking out the code on the book, and tapping to understand the knowledge points. Here comes the installation of Eclipse, no words behind the teachings.

Then, learn the basics of Android development. Choose the "Android Crazy Handout" or "Ohpone full handout" compiled by Li Gang, choose one, don't be greedy. The former book code in detail, according to knock Basic can be perfectly run, at least read the first 10 chapters, with the book instance of a also do not let go; the latter book has more development experience, the case explained rich in the analysis of the reason is suitable for the former village Nowhere foundation of the lack of people, at least read the first 8 chapters. Here comes the installation of the Android development environment, no words are taught behind.
@2. How do I install eclipse?
method: First install the JDK, download the installation on Oracle website www.oracle.com/technetwork/java/javase/downloads/. Then install Eclipse and download it on its official website www.eclipse.org/downloads/. As long as the JDK is installed properly, eclipse can be used directly, Eclipse has multiple versions for different needs, we download the standard version or the mobile development version. This step if there is a problem, more Internet search, do not worry about trouble, error is not OK, mentality to be put.

3. How do I install Android?

In fact, this question is problematic, the installation of Android should be understood as a mobile phone or other mobile devices installed on the Android operating system, we are talking about how to install the Android development environment/development components. Because the general small white in the need to install the Android development environment/development components, will be omitted to such a method, so use it as a title, by the way with the second section of the title corresponding.

Then you need something called the SDK (software Development kit, software Development Kit). Any development language/platform, to facilitate developers to develop work, must give them tools, these tools in a toolbox, this is the SDK. We want to do Android development, of course, download the Android SDK, the official site is: https://developer.android.com/sdk/index.html. When you open the Eclipse interface with ADT, you'll see two more Android-related buttons, as shown in. One is the icon with a downward arrow in the middle of the green Robot Belly (Android SDK manager), and we are downloading the Update SDK by clicking on it; one is a small robot avatar (Android Virtual Device Manager) in a green phone screen. We create and manage the simulator by clicking on it.

Figure 1 ADT Installation Success

Internet search, almost all the posts are first said to need the SDK, and then install ADT. However, from a practical point of view, the individual felt that the first ADT after the SDK more in line with the actual installation order, hoping to correct the internet for the majority of the first installer error guidance.

method : currently (since 2013) The Android website directly provides packaged eclipse (the icon for the "small robot" that thing), directly download unzip everything has, very convenient to use, for http:// Developer.android.com/sdk/index.html.

When we install/update the SDK through ADT, problems such as difficult to download often occur. In view of this, specifically pull out a section to help you solve this problem, see "How to update the SDK" below.

4. How do I update the SDK?

Common Method One : Open the SDK Manager and select Update. Disadvantage is the domestic network problems, often can not complete the download or download very slow.

Treasure Method : To find a colleague who has updated, go to the SDK root directory under the Platforms folder, you can see a number of folders named Android-number, as shown in. Each number is an Android API designator, such as ANDROID-17, which is the SDK for API 17. Select the API folder you want, such as 4.0.3 API for 15,4.2.2 is 17. Copy to the same directory under the SDK of your computer and restart eclipse.

Figure X SDK API folder

5. Do I have to synchronize the latest SDK?

In two cases:

First, we mainly do mobile phone operating system, the inside of the upper application maintenance, so, do not need. That is, we develop Android4.4 projects, the use of the SDK API maximum support of 4.0 does not matter. As long as you can read the code and make changes.

Second, unless it is to independently develop the Android4.4 apk.

6. Required Skills for entry level?

At this point, make a brief summary: You are already a beginner of Android development level.

At this point you have the following skills:

First, the tool OK (can be built independently of the development environment with the help of the installation guide). With a well-developed eclipse, you can build your Android project in good condition and work properly.

Second, basic skills OK. With Java and Android development knowledge, can read code, can carry out basic development.

7. How to advance after getting started?

Once you get started, a lot of people go into the next confused period: What do we do next? Student friends will be bored and unable to improve, the work of friends on the one hand want to rush into the actual project began to produce, on the one hand on the ability to assume the actual development of the task and disturbed afternoon.

If the developer at work (mobile phone system development and maintenance), start the Android system (source directory structure, source content, etc.) as soon as possible to learn; If you are a student and other friends, then continue to develop advanced Android technology learning, by reading the handout, practice more code, Until the development of a personal application shelves to the Android application market (this is not detailed, the online forum many can learn more about). The following content, mainly for the work of mobile phone system development and maintenance of developers, determined to enter the field of mobile development friends or to do the APK application development friends please use their own needs to read.

Once you get started, you can start learning, pre-researching the actual project code, and mastering the tools you need to use in various projects. The most important thing at this stage is asking and doing more, because a lot of knowledge does not necessarily have ready-made documentation to teach you, such as how most development engineers in your daily work can save time and much more. Behind the content, that is, the fundamental point of these operations, as long as the practice of familiar, in the process of natural can experience and master a lot of skills and skills. Let ' s begin.

8. How do I download the code?

The first step is to download the project code (the environment used in this article is Unbuntu 10.0.4LTS).

Description: For security reasons, the general company controls the download permissions for the code. To download from the server you must first request permission to open the downloaded code. As to how to apply for the opening, as the content of this section is not very related, please see the following section Git/gerrit.

Method:
Ask the integration engineer or other senior colleague to let him know the command to download the code.
Open the terminal, enter the command into the place/path to be stored (using the/local directory here),

$cd /local

New Source Directory,

$mkdir eyelike-v1.0-dint

Then go to the source directory,

$cd eyelike-v1.0-dint

Enter the download command in the source directory,

$repo init –u git@10.92.32.10:alps/manifest.git -m eyelike-v1.0-dint.xml && repo sync

When you meet the confirmation user name and password, press Enter and press Y when you encounter the confirmation download. Waiting for half an hour or so to download is a success.

9. How do I import an entire project in eclipse?

We read the code, which is usually done in eclipse. The code has already been downloaded and will immediately encounter problems with how to import the entire project in Eclipse.
Method:
1. Locate the root directory of the source code that you downloaded, such as the previously downloaded Yarism-v1.0-dint, into the following path:

工程名(这里即是eyelike-v.10-dint)/development/ide/eclipse

2. Show hidden file (press shortcut key Ctrl+h), will find a hidden file called. Classpath, copy, paste to the source code root directory, here is the Yarism-v1.0-dint folder below.

3. Then, open Eclipse and create a new Java project, with special attention to Java Engineering, not Android engineering.

4. The default path (use default location) before the small tick cancellation, select the source code path, here is the full path of the Yarism-v1.0-dint folder, click OK, you can complete the source code import.

Special note : Due to the large amount of code, it is generally necessary to wait several minutes to complete the import. At this time, the project name appears next to a small red exclamation mark is normal phenomenon, do not affect code reading, jump, etc., everyone is like this, do not worry.

10. Which part/module of the code to start with?

There are very many folder directories and class files in the source code, which will certainly be my head after the project is imported. How do you begin to read it? The best way of course is to start with a small part of the reading and then slowly expand. And "A small part", we often use "module" as the unit. At this point, we must explain the division of the module.

First, from the perspective of mobile phone function. Our mobile phone can make phone calls, send text messages, send email, use Bluetooth for file transfer, camera, listen to music watching video and many other functions. And the reason we can use these features is because of the implementation of these features in the system code.

Then from the source point of view to explain. In the source code, these codes are packaged according to functionality, stored separately under different file directories. On the one hand convenient development, on the one hand to facilitate subsequent reading maintenance. As the upper-level application development and maintenance, the main involved in the code directory is: Eyelike-v1.0-dint/packages/apps. When you enter this directory, you will find a lot of folders with names such as Calendar, Settings, camera, etc. And roughly speaking, each folder is a module.

The next step is to complement the organizational structure of the Department. A software development department is grouped according to different functional modules, the group generally includes: Integration Group (Development environment Building maintenance, Code Release management, custom framework development functions), System group (System allocation maintenance, driver development, upgrade, system test tools development and maintenance functions), Application Development group (each upper application, System applications, third-party application development and maintenance functions). At this point, you should be able to understand this article is mainly to do the application Development Group of students (System development in the upper application development and maintenance). So in detail which also includes which TEAM:APP_PIM (responsible for browser, Email, contacts and other modules), app_connectivity (responsible for Bluetooth, GPS, WiFi, NFC and other connection related modules), APP_ Multimedia (responsible for audio and video players, cameras and other modules), App_localservice (responsible for launcher, settings, lock screen, third-party apk and other modules). Each team is responsible for developing and maintaining the different modules that are divided.

Combining the above three angles, we must first determine our own development direction: which group which module. So you have to find the module you want and get into the team to learn. This step more to think about their strengths and weaknesses, their interests, and more with the mentor/teamleader to communicate understanding. In the end, make your own choices.

11. How do I start a module?

When the module is determined to enter, it will begin to learn the module, preferably through the code of learning and PR walkthrough Two steps to slowly go deep. Usually a module is some of the existing summary documents can be taken to view learning, play a more subjective initiative to ask the same module colleagues, as well as online query is very necessary.

A good code learning method is to understand/understand the use and performance of this module in the mobile phone first. The following is a description of Bluetooth as an example. For example, into the Bluetooth module has three portals, one is the settings of the Bluetooth settings, one is the notification bar drop-down list shortcut settings in the Bluetooth switch, and the file sharing is the pop-up via Bluetooth selection interface. Next is its specific function, transfer files, switch operation, search the surrounding Bluetooth device, visible settings, rename Bluetooth device, view upload download history and so on. In this regard, as long as a mobile phone to use the familiar can grasp, and generally our daily use of mobile phones may have been more or less understand contact, need to do the key work is: systematic understanding of its working mechanism, more comprehensive than before the omission.

Then, find the package, class for the external function in your code. Doing this is relatively difficult for a person who knows nothing about the module. Take it easy and spend more time and energy. The first method first when asked the same module of senior colleagues, ask him to indicate the main package, class, it may take only 5 minutes to give you a little bit, you can spend less than a few days of time! Thank you very much colleague! Then, the General learning Summary, technical documents will contain the code structure, find it, research understanding familiar.

Here, we have to introduce the method of connecting the real machine for debugging.

12. How do I use Eclipse debug phone code?

Method:
1. Select the DDMS, connect the phone, select the process to debug;
2. Select Run→debug configurations;
3. Under Remote Java application, select the project you want to debug.
4. On the right option port type: 8700;
5. Then set the breakpoint at the code you want to debug and click Debug.

explanation : This way, when the phone is clicked, when the code runs to the breakpoint, the phone will not continue to run, you can press F5/f6 to step through debugging, in the code can see the variables and other code information. With this approach, you can skillfully read the code: for example, set a breakpoint at the very beginning of the class that will enter the Bluetooth settings, and then debug it, so that you can follow the steps of each operation in a step-by-step manner.

Android Developer Get started (i)

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.