This article was first published on wechat official account “Liu Wangshu”

This is the third installment of BATcoder, an add-on to the Android Advanced Trilogy, which expands and updates the Android Advanced Trilogy and will be shared as a video. The reason why I call it BATcoder is because I want you to watch my video and get into your favorite factory.

This is probably the simplest article I’ve written in years, but if it helps a few people, it’s useful.

In Android advanced trilogy second “Android advanced decryption” in the first chapter, I introduced two ways to read the source code, one of which is from Baidu network disk: pan.baidu.com/s/1ngsZs will download the source code, and then use SouceInsight to view, this way is very convenient, suitable for reading the source code, but there are two disadvantages, one is not able to obtain the latest source code, the other is not able to compile the source code. Because we will compile and debug the source code later, the source code compilation needs to be carried out in the Linux environment, many students do not have Ubuntu system, but we can use VirtualBox on Windows and Mac to install Ubuntu (Mac can directly download AOSP, but may pollute the system). Therefore, before explaining the download system source code, I will first explain the Windows10 environment, VirtualBox to install Ubuntu process, Mac environment is similar. You can also download Ubuntu for Windows 10 from the Microsoft Store.

Video version

Many details, only in the video version ~ welcome to watch the video

Independent blog viewing

B stand to watch

The preparatory work

First you need to download two files:

  1. VirtualBox: download address is: www.virtualbox.org/wiki/Downlo…
  2. Ubuntu desktop version: download address is: www.ubuntu.com/download/de…

Installing VirtualBox is a simple step along the way. This section mainly explains how to install Ubuntu VirtualBox.

VirtualBox install Ubuntu

1. Click VirtualBox Create button to create a virtual computer.

If the 64-bit option is not available, access the BIOS and enable CPU virtualization. Different motherboards into different ways (specific please their own Baidu), such as my HP desktop, in boot by F10 will enter the BIOS, in security -> system security -> virtualization technology options Settings can be enabled. If there is still no 64 – bit option please see this article: blog.csdn.net/tai53243990…

2. Set the memory allocated to the VIRTUAL machine. The recommended memory for this version is 1 GB.

3. Create the size of the virtual hard drive and click Next.

4. The recommended size of the virtual hard disk is 10GB, but if you want to compile Android source code, you need a larger hard disk space, the recommended minimum amount of 200GB, I have 200GB.

5. Select Ubuntu and click Start.

6. Select the downloaded Ubuntu image and click Start.

7. Select a language and install Ubuntu.

8. Follow the steps below.

9. Enter your name and password and click Continue:

10. Start installing Ubuntu. Once installed, click Restart Now and you’re done.

Install enhancement tools

There are two main purposes for installing the enhancement tool:

  1. File sharing between the Vm (Ubuntu) and host (Windows).
  2. You can use full screen mode.

1. Configure Ubuntu to turn on the top of the screen in the user interface.

Create a shared folder and select Auto Mount and Fixed Assignment.

Selecting Devices -> Install enhancements at the top of the emulator screen will generate a drive letter for vbox_GAS_6.0.4 on the desktop and then configure it. If no drive letter is generated, search for it in the file.

2. Install the enhancement tool

Install GCC and perl libraries first:

sudo apt-get install gcc perl make
Copy the code

Go to the vbox_gas_6.0.4 directory in your desktop or Ubuntu main file and click Run to install the enhancements.

If the following information is displayed, the installation is successful.

The current user has not been added to the vboxsf group:

sudo adduser zhangrj vboxsf
Copy the code

Restart Unbantu. At this time, a drive letter will be generated on the desktop, through which you can share files with the host. If no drive letter can be generated, you can find it in the file.

In addition to installing the enhancement tools, there is another feature that is very commonly used, sharing the stickboard and dragging and dropping in Settings -> General -> Advanced to make the interaction between the virtual machine and the host easier. See this video for more details.

Independent blog: liuwangshu. Cn/batcoder/ao… B station address: www.bilibili.com/video/BV19p…

Author introduction: Liu Wangshu, the most valuable expert of Tencent Cloud, is the author of the best-selling books “Android Advanced Light”, “Android Advanced Decryption”, “Android Advanced Refers to the North”, has been awarded the annual excellent author of The Publishing House of Electronics Industry for three consecutive years, the former huawei interviewer, is now the technical director of Dachang, Google Developer community guest lecturer.

Also welcome to pay attention to my public number will share big front-end, Java related technology.