Android compilation system-envsetup. Sh

Source: Internet
Author: User

The android build system can compile different products from the same source code with different packages and options. To implement this function, we need some environment variables to control which compilation is required and how to compile it.

Envsetup. Sh is one of the methods. envsetup. Sh will generate some tools that can be used to conveniently compile the source code. envsetup. Sh will include the following files.

Vendor/*/vendorsetup. Sh

Vendor/*/build/vendorsetup. Sh

Device/*/vendorsetup. Sh


$ source build/envsetup.sh

Or

$ . build/envsetup.sh

After running envsetup. Sh, you can use help to view available tool functions. Note that the Help Command of the original shell system has been overwritten by the Help Command of envsetup. Sh.


In general, you will use choosecombo to define compilation options. choosecombo will prompt you to enter the corresponding compilation parameters step by step. choosecombo will set the following parameters:

  • Product (generic or board-level platform name)
  • Build varient ('user', 'userdebug', or 'eng '), see the difference between the three http://www.kandroid.org/online-pdk/guide/build_system.html#androidBuildVariants
  • Build for the simulator or the device, whether to support simulator, the target_simulator environment variable is set
  • Build type ('release' or 'debug'). The target_build_type environment variable is set to release or debug.

After defining the compilation environment variables, you can use M, mm, and mmm for compilation. In addition, envsetup provides several convenient tools, Croot, cgrep, jgrep, resgrep, and godir. Use the Help Command

  • Croot
    Change the current path to the root directory of the android source code
  • M
    Compile the entire android Project
  • Mm
    Compile all modules in the current directory
  • Mmm
    Compile a module specified by parameters, such as Mmm Dalvik/dexdump
  • Cgrep
    Query all c files (*. C, *. CC, *. cpp, *. h) in the current directory and subdirectory that meet the query conditions)
  • Jgrep
    Query all the java files (*. Java) that meet the query conditions in the current directory and subdirectory)
  • Resgrep
    Query all resource-related files in the current directory and subdirectory (*. XML)
  • Godir

    Change the current path to the directory containing the file. If multiple paths contain the file, a list is provided for selection. The first time you run godir, an index is generated. This index is actually a huge text file that contains a list of all file paths. You can view it in VI: Croot; VI filelist.




Related Article

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.