13. How to fully compile the code?
Since the above describes how to connect to the real machine for debugging, it is necessary to quickly complement the fully compiled method. Because you want to debug online, you first have to fully compile the corresponding code. Many new people have a lot of doubts when it comes to online debugging: Why does Eclipse know when the hand is running and that it can run the code together? To answer these questions, you must first understand the full compilation .
Full compilation is to tell the entire development environment what code is in the project, what resources to convert our Java code into a machine/environment-aware format, and tell it beforehand. This way, Eclipse knows what's going on in the phone when it connects to the real machine. Of course, the system version used by the phone and the version of code in eclipse need to be consistent (sometimes just debugging a module, keeping the module code version consistent in most cases is also possible, why most?) Because a module is inevitably associated with code in other parts of other modules, if the code in the other part does not keep the same version but is called in the debug run, there will be an error that eclipse does not know about. Finally, explain what Eclipse uses to make the code run with the phone, which basically explains the doubts of the newcomer: through ADB and DDMS.
The source code of the MTK provided by the baseline (baseline code) and Google provides Android native codes, the former on the basis of the latter added a lot of MTK's own custom features and code. Therefore, the method of full compilation also divided into two kinds: the whole series MTK platform code, the full compilation of Google source.
The following first the MTK platform code full compilation method:
1. Open the terminal and go to the source root directory (Eyelike-v1.0-dint for example):
$cd /local/eyelike-v1.0-dint/
2. Enter the command:
$./makeMtk listp
3. The contents will appear at this time:
Figure X fully compiled project
Special Note : We can see a list of project names that show that there are so many items in the list under the Code branch (that is, they share this set of code and why are they shared?). Because we have a custom mechanism that can be controlled by Perso to meet the needs of different projects. We find the desired project name, this example is the JRDHZ72_WE_JB3 (why is this name not the other one)? This is because the name is written by the project manager or the integration team that manages the code, and when you don't know it, ask them to know about it, and there's no other special reason. Of course you can also use the other names in the list for full compilation, but obviously you are compiling the items that correspond to the other names.
4. Then enter the fully compiled command:
new jrdhz72_we_jb3
5. After you enter, you can start compiling. Depending on the platform, it takes half an hour to a few hours to vary.
Then the full compilation method of Google source code:
1. Open the terminal and enter the source directory (here Kitkat-v1.0-dint for example):
$cd /local/kitkat-v1.0-dint/
2. Enter the command:
$make
Description: Google source code can be fully compiled using the Make command, and if multiple threads are required to compile, use the following command:
$make-j8
Description :-j represents a thread, 8 means 8 threads, multithreaded compilation can shorten some compile time, but sometimes there are compile errors that may occur because the thread is running on a non-linear basis. Therefore, it is advisable to use the make command directly in time-sufficient situations.
14. What is ADB?
The full name of the ADB is called Android Debug Bridge, which is a bridge to the Android debug communication, it is like a responsible middleman, keep the eclipse (development environment) and phone code running synchronization state. With this tool, we can manage the status of the device or phone/emulator. You can also do the following:
1. Quickly update the code in the device or phone simulator, such as app or Android system upgrade;
2. Run the shell command on the device;
3, management equipment or mobile phone simulator on the predetermined port;
4. Copy or paste files on the device or phone simulator;
We typically enter adb XXX (command) to use in the terminal. This can be learned in a later example operation. The DDMS full name is called the Dalvik Debug Monitor service, which specializes in debugging monitoring services for Dalvik virtual machines in the Android development environment.
15. What is DDMS?
The full name of the DDMS is the Dalvik Debug Monitor service, which is the Dalvik virtual Machine Debug Monitor in the Android development environment. It provides us with examples of screenshots for a test device, viewing running threads for a particular process, and heap information, LOGCAT, broadcast status information, analog phone calls, receiving SMS, virtual geographic coordinates, and more. Because we are in the actual development of maintenance work, DDMS use frequency is simply too high, too important, so we must explain in detail DDMS.
In the integrated development environment, there is a DDMS console window. For example, in MyEclipse, there is a console called DDMS.
1. How to start DDMS
This tool is stored under the Sdk-tools path, starting with the method:
1) Directly double-click Ddms.bat Run;
2) Start Ddms during the Eclipse debugger, as in eclipse:
Window-open Perspective-ddms, click to start it.
DDMS to emulator and external testing machine equivalent, if the system detects that they (VMS) run at the same time, then the DDMS will default to emulator, the above two start-up operation some different, recommended to try separately;
How the 2.DDMS works
DDMS will build a link between the IDE and the test terminal (emulator or connected device), they use their own independent port monitoring debugging information, DDMS can monitor the connection of the test terminal in real-time. When a new test terminal is connected, DDMS will capture the ID of the terminal and set up a debugger through ADB to achieve the purpose of sending instructions to the test terminal;
Ddms listens to the first terminal app process port for the 8600,app process will allocate 8601, if there are more terminals or more app processes will follow in this order and so on. DDMS receive instructions for all terminals via 8700 port.
3. Learn more about DDMS features through the GUI
Devices:
In this panel you can see the information of all terminals connected to the DDMS, as well as the app processes that each terminal is running, and the right side of each process corresponds to the port linked to the debugger, because Android is an operating platform based on the Linux kernel, and also retains the unique process ID of Linux. , which is between the process name and the port number;
Emulator Control:
Through the functions of this panel can be very easy to enable the test terminal simulation of real-world mobile phone with some of the interactive functions such as: Answer the phone, according to the options to simulate a variety of network conditions, analog accept SMS messages and send virtual address coordinates for testing GPS functions;
Telephony Status:
Analog voice quality and signal connection mode via options.
Telephony Actions:
Analog phone answering and sending SMS to the test terminal.
Location Control:
Simulating geographic coordinates, or simulating dynamic alignment changes and displaying a predetermined geographical identity, can be done in the following 3 ways:
Manual:
Manually send two-dimensional latitude and longitude coordinates for the terminal.
GPX:
The data of GPS changes in travel is simulated by using the GPX file to import the dynamic geographic coordinates of the sequence.
KML:
Import unique geographic identities through KML files and dynamically display them in a test terminal based on changing geographic coordinates
16. How to pre-research PR?
In the module code has a preliminary understanding and familiarity, you can wear into the module related to the PR drill. What is PR? In this article, the PR (problem Request) refers to a bug that can be understood as a problem solved by a software development engineer. Learning about other people's problems is a very good way to quickly understand the problems that may be encountered in the future and to master the methods of solving them.
Can find an earlier project, such as yarism, search for it above the Bluetooth (Bluetooth module for example) related to the PR, try to understand the PR description of the problem, and then go to find the solution of the code location and way. I am not familiar with the module, it is not clear which PR is representative, so you can ask senior colleagues to help screen some PR out. Ask your senior colleague or Teamleader to help you! Thank them again!
Then, do not look at other people's modification method (how can you see?) Do not have to teach at the back, think independently. Yes, we must think independently, if the time is really limited, but also must be in their own thinking after the situation is not able to see other people's changes. Also, look at other people's changes to try to understand the ins and outs, why can solve or why this solution. When oneself also has the thought and the other person's modification is not the same, must not let it go, put the horse to ask the change colleague, asked him at that time how to think, why so change, finally only then will your own idea tell him, at this time often he will tell you the flaw of the method! Yes, the idea of a novice like you is often flawed! However, this is the moment you leap! God, every time you encounter such a chance, is a powerful upgrade!
17. How do I view other people's change records?
Our PR (bug/problem) is managed by Bugzilla (Problem management tool, which is a website for users). We can view all the PR of all items on the bugzilla (in fact, RR/CR/FR, but this article all use PR instead of description) record (as long as the permission is sufficient). Search any existing PR number, you can enter its detailed information interface, can see its problem profile, problem description, recurrence steps, modify history, modify notes (Comments), project name, final resolution time, current resolution status and so on. The most important thing to learn about a PR is to read its description of the problem, understand the problem, and then look at the notes in comments. In order to better manage PR and to modify the relationship between records, the script tool is used so that after each submission of the solution, Bugzilla automatically inserts the link to the solution in a comments way below the PR. Therefore, we can generally find some links in comments, it is what we need! And these links, is the Gerrit website revision history link, above recorded the code changes and so on information.
18. What is Git/gerrit?
At this point, it leads to git. Our code is managed by GIT (Code Distributed Management tool) and stored on a dedicated code server (in the Integration group's office, an integration team is dedicated to maintaining). After we really solved a problem, all the code changes were committed to the GIT server and saved in the form of a git repository.
Description : Many people may have heard of CVs and subversion before, and they are also code management tools. We're going to use git as a description, and the author is more inclined to git. On the one hand, the author department uses it for code management, on the other hand, the hot and abnormal XXX website is dominated by git, the personal feel is trend.
18.1 Etymology
Gerrit (Code Audit Server) is a Web site for code submitter. In order to ensure the quality of the code, the general code after the submission of a senior engineer for code review, audit through the post can eventually be submitted to the GIT library.
The code submitter pushes the code through a git command (or repo encapsulation) to the GIT repository under Gerrit management, then goes to the Gerrit site to set up the reviewer (Reviewer) for the code change, converts the commit to one of the code review tasks, and the audit task can be refs/ The reference under changes/is accessed. Code reviewers can view audit tasks, code changes, and make decisions through the Web interface through code reviews or calls back through the Web interface. The tester can also test it by refs/changes/reference Fetch (FETCH) revisions, and if the test passes, it can set the review task to validate pass (verified). Finally, the revision of the audit and validation can be merged into the corresponding branch of the repository via the commit action in the Gerrit interface.
Earlier in the section on downloading code, mentioned the permission to download code, in fact, the permission to download code, and also corresponding to the permission to submit code. Since both of these operations are on the Git/gerrit server, let's talk about how to open these permissions in more detail next.
18.2 Opening Git/gerrit Permissions
First time login Gerrit
1. In Ubuntu, enter ~/.SSH to see if there are no id_rsa.pub files, and if not, execute the command:
$ssh-keygen-t rsa
Note: During the execution of the command, you will be asked the key to save the path, select the default.
2. Continue to execute the command:
$git config --global user.email <email_address>
Note: Is the mail address used by the company, Gerrit need to verify the user's email address when submitting the code, the code may not be submitted without executing this command.
3. In the browser, enter the following URL to access the Gerrit server: http://gerrit.eyelike.com:8081/.
4. Open the Web page and click Sign in at the top right corner to log in using the username and password (domain account) used to log in to Windows, as shown in:
Figure x Gerrit website Landing screen
5. Log in and click Add Key to paste the contents of the id_rsa.pub into the input box and click Add. This key is to be used for GIT authentication in future push code. As shown in the following:
Later in use if you want to change or add additional SSH key can be logged into the Gerrit after the SETTINGS->SSH keys to operate.
6. Then send mail to the integration group to manage the Git/gerrit website colleague, at the same time id_rsa.pub as an attachment sent to him, and copied to Teamleader, request to open code download and submit permissions, you can.
[Email protected]
Android Developer Tips (ii)