android build system get the source code path base on package name Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of android build system get the source code path base on package name without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I want to get package source code base on package name, eg xxx.apk

I know it could filter by grep LOCAL_PACKAGE_NAME. but the AOSP source was too large.

Is it any build system command could list all package name and path?

Regards

Answer

TLDR

. build/envsetup.sh

# Show list of modules for the selected configuration.
lunch
m modules

# Grep for your module.
mgrep <module>

Explanation

After calling . build/envsetup.sh you can use mgrep to only grep build configuration files.

Be aware, that Android currently uses two build configuration types in parallel. The old makefile type files (Android.mk) will contain LOCAL_PACKAGE_NAME. However, the new Soong module files (Android.bp) have a different syntax. You better grep for the module name and not for LOCAL_PACKAGE_NAME.

You can use m modules to get a list of all modules known to the build system. This command requires you to run lunch first. Also the list returned by m modules will only contain the modules that are selected by the lunch configuration.

We are here to answer your question about android build system get the source code path base on package name - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji