Generate AOSP build system files from APK

⚠️ This library is a Work in Progress! ⚠️

Generate AOSP build system files from APK

⚠️ This library is a Work in Progress! ⚠️

A command-line tool to automatically generate or Android.bp from Android APK-s.

The genapkbuild tool will analyze APK for architectures, find NDK-generated libraries inside and generate makefile ( or soong (Android.bp) for it. By default it will generate make files but it can be changed to generate soong files (Android.bp) by passing different flags.

This tool supports pre Kit-Kat style makefile generation too, by extracting .so libraries from the APK and linking them into the makefile automatically.

See flags below for more information.

Inspired from northbright's tool written Go, ported to Rust and built on top of it, not backwards compatible with that tool (for the most part).


If you have Cargo installed, you can install this tool by running cargo install genapkbuild To build from source, you need Rust compiler, clone this repo and run cargo build --release. A binary genapkbuild will generated in target/release/.

If you don't have the compiler installed, you can download the binary from the release tab


Input flag [Required]

-i --input <apk path>

This flag is required, it supplies the path of the APK we want to generate the makefile or blueprint for.

Soong (Android.bp) flag

-s --soong

This flag will create Android.bp instead of

Extract flag

-e --extract

This flag will create pre Android 5.0 style makefiles by extracting/copying native libraries outside of APK into /lib/<abi>/lib<name>.so and linking them to the makefile. Disabled by default.

Architecture (ABI) flag

-a --arch <ABI>

This flag will allow you to set a default architecture for the APK you are bundling in BSP. This is neccessaary when more than one architecture is found and the tool doesn't know which one to prefer. If there's only one architecture supported, it will auto-pick that.

Privileged flag

-p --privileged

This flag will make the apk a privileged system app located in priv-app.

Dex Pre opt

-d --dex <true or false>

Pre-optimization can also be enabled or disabled on an individual app basis by specifying this flag.

Name flag

-n --name <APK name>

If the apk name is different from the one supplied with the -i --input flag, you may change that with this flag. If not supplied, it will get whatever was passed in the input flag.

Verbose flag

-v --verbose <APK name>

Enable verbose debug logging, by default disabled.

Version flag

-V --version

Prints version information.

Help flag

-h --help

Prints usage information about the tool.


Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or
  • MIT license (LICENSE-MIT or #404)

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


Collection of the latest Issues




Currently, in makefiles the ABI and native libs are being de duped which leads to slightly inaccurate generation at the end. E.g. the following:

would output:

where as this should output:


Find the latest versions by id

1.5 - Nov 01, 2021

Implements native lib for blueprints through arch:abi Improves cli arguments for -arch to handle arm/arm64 which respect build system requirements

1.4 - Sep 24, 2021

Improve --dex option, allow flags to be passed, sync mk and bp for similar behavior. Rewrite generation for better perf. Add unit tests for Android.bp

1.3 - Sep 22, 2021

Add partial support for soong, using -s or --soong flag this tool now outputs Android.bp file. Refactor and clean up.

1.2 - Mar 25, 2021

Adds support for multiple architectures via the -a flag, comma separated. e.g. -a armeabi-v7a,arm64-v8a Fixes a lose \ at the end of the NDK libs.

More tests and fixes.

1.1 - Mar 22, 2021

Adds support for multiple architecture generation. Adds some input validation for architecture. More tests.

1.0 - Mar 21, 2021

Initial release.

Information - Updated Dec 06, 2021

Stars: 4
Forks: 2
Issues: 1

SUPER Android Analyzer

Secure, Unified, Powerful and Extensible Rust Android Analyzer

SUPER Android Analyzer

Rust core for native Android and iOS apps

The Android build contains a wrapper library, which is imported in the Android app with Carthage

Rust core for native Android and iOS apps

cargo-ndk - Build Rust code for Android

This cargo extension handles all the environment configuration needed for successfully building libraries

cargo-ndk - Build Rust code for Android

Very simple command line tool to setup configuration for android native binaries

If you want to use native binary in your android project, and you don't like to write it in C/C++, writting in rust can be...

Very simple command line tool to setup configuration for android native binaries

Rust bindings for Oboe library

Oboe High-Performance Audio library for Android

Rust bindings for Oboe library

The answer to &quot;how do I use Rust on iOS and Android?&quot;

cargo-mobile takes care of generating Xcode and Android Studio project files, building and running on device, generating project boilerplate, and a few other things!

The answer to &quot;how do I use Rust on iOS and Android?&quot;

EndToEnd Anonymus chatting app

With Rust Backend and Android support

EndToEnd Anonymus chatting app


Crossplatform mobile solution based on Rust for IOS &amp; Android

Facebook Instagram Twitter GitHub Dribbble