Coder Social home page Coder Social logo

build-tools's Introduction

aapt-cmake-build has been renamed to build-tools

update android version to android-11

At first, we cannot directly use the termux to build AOSP, because blueprint and soong compilation fails, but if you can successfully compile blueprint and soong, maybe you can use termux to compile AOSP, we only need to replace the prebuilts toolchain.

Since it is not possible to compile android-sdk directly through the mm sdk command, so choose cmake to compile each tool separately.

Building android-sdk/build-tools, such as aapt aapt2 aidl zipalign adb fastboot ... which supports compiling with Termux.

In order to download the source code more conveniently, termux needs to install aarch64 version of Linux. TermuxArch is recommended, Of course you can also install other Linux distributions, ubuntu debian kali ... etc.

ArchLinux only downloads source code, we are not using it to compile.

If you need other tools, please add the cmake script of the corresponding tool under build-tools/cmake

you can use prebuilt ndk to compile, ndk from termux-ndk or use termux's clang to compile, If you want to compile statically with termux, you need install ndk-multilib, pkg install ndk-multilib and add LDFLAGS="-static -fuse-ld=lld", lld compatibility is better and faster.

The compiled binary files are placed in the android-sdk/build-tools and platform-tools


How to build

# install repo
pacman -S repo

cd build-tools/android-11

# download source code
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone

# for china
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone

repo sync -c -j4

# download finish, exit ArchLinux
exit


# start building...
cd build-tools && mkdir build && cd build

TOOLCHAIN=/path/to/android-ndk-r21/toolchains/llvm/prebuilt/linux-aarch64

cmake -G 'Ninja' \
    -DCMAKE_C_COMPILER=$TOOLCHAIN/bin/aarch64-linux-android29-clang \
    -DCMAKE_CXX_COMPILER=$TOOLCHAIN/bin/aarch64-linux-android29-clang++ \
    -DCMAKE_SYSROOT=$TOOLCHAIN/sysroot \
    -DCMAKE_BUILD_TYPE=Release \
    ..

ninja -j16

If you download the source code that is not android-11, you need to modify build-tools/CMakeLists.txt

set (AOSP android-11) Change to download the corresponding Android version.

the source code of each Android version has been changed, and direct compilation will fail.

You need to refer to the Android.bp file and modify the corresponding CMakeLists.txt

reference lizhangqu


screenshot.jpg image

build-tools's People

Contributors

lzhiyong avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.