Android source code compilation and its running simulator related issues record

Source: Internet
Author: User

Recently has been looking at the Android source code related documents, including compiling the source, as well as the framework layer, I am very lazy, has not written blog, today I would like to compile a source code, and run in the simulator.

Different versions of the source code, the required JDK may also be different, all reference to the official documents, download the source code method also refer to the official documents.

Note: 1. Environment variables should be set correctly, do not appear error

2. Basically no one can successfully compile the source code, how much will be wrong, according to the prompt to modify the error, install some packages and libraries can be done, specific problems specific search, I encountered problems can also be many, are in accordance with official documents to solve. Some issues may be related to your build environment, which is not covered here.

Here's a breath of my environment variable set:

Execute command gedit ~/.BASHRC After opening the configuration file, add the following content

Export ANDROID_HOME=/HOME/CAI/CANDY/DEVELOP/ADT-BUNDLE-LINUX-X86_64-20131030/SDK

Export path= $PATH: $ANDROID _home/platform-tools

Export java_home=/usr/lib/jvm/jdk1.6.0_45

Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export path= $PATH: $JAVA _home/bin

As a reference, I compiled the source code is 4.3, if you compile the latest 4.4 estimate requires JDK is version 7.

After downloading the source code, compile the source code, still follow the official documents, execute

SOURCE build/envsetup.sh

Lunch

There are some items to choose from

You ' re building on Linux

Lunch Menu ... pick a combo:
1. Aosp_arm-eng
2. Aosp_x86-eng
3. Aosp_mips-eng
4. Vbox_x86-eng
5. Aosp_flo-userdebug
6. Full_grouper-userdebug
7. Full_tilapia-userdebug
8. Mini_armv7a_neon-userdebug
9. Mini_mips-userdebug
Ten. Mini_x86-userdebug
Full_mako-userdebug.
Full_maguro-userdebug.
Full_manta-userdebug.
Full_arndale-userdebug.
Full_toroplus-userdebug.
Full_toro-userdebug.
Full_panda-userdebug.

I'm here to choose the 1,Aosp_arm-eng

I was mostly done in the simulator, so the AOSP would be all right.

Last Make-j4

Compile errors are generally related to fewer libraries, as prompted to install the relevant library.

After compiling, we can use the Android emulator emulator to run the compiled source code, the completion of the compilation will generate the corresponding system.img,userdata.img,ramdisk.img are ~/android4.3/out/ Target/product/generic can be seen below, so we need to add environment variables

Export Android_product_out=~/android4.3/out/target/product/generic

Export Android_product_out_bin=~/android4.3/out/host/linux-x86/bin

Export path= $PATH: $ANDROID _product_out_bin: $ANDROID _product_out

In the end, we can start the simulator by executing emulator.

However, restarting a command terminal will cause the following error to execute emulator

Emulator:ERROR:You did not specify a virtual device name, and the system
Directory could not being found.

Do not know that everyone has met, so I looked up some information, found in the environment variable to add the following source path is good

Export android_build_top=~/android4.3

may be related to version, current workaround set android_build_top environment variable

Emulatro-skin WSVGA

You can then modify the framework source code and then view the effect in the emulator.

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.