Friday 17 March 2017

Some famous Android Make and ADB command



Hello Guys !!! Hope you all are doing well !!!!
In my previous post, I have given detail explanation of AOSP build process and its make command.
Today I am going to list down some famous and useful make and ADB command for android source code build(AOSP).

Android source code build process
Very first time after opening the terminal(Ubuntu/Linux) we have to give following set of command

1. Go to the <aosp_working_dir> ( type cd /u-dir/aosp_android_dir>)

2. then use source source build/envsetup.sh

3. Then use lunch command and choose your lunch option

4. And in the last have to give make -j16 or make -j8 command for build

Below is the some useful make command

1. Seeing the Build Commands
When we build the AOSP, it doesn’t actually show us the commands it’s running. Instead, it prints out only a summary of each step it’s at. If we want to see everything it does
make -j4 showcommands

2. To compile an app
if you want to build .apk file from your <aosp_working_dir> without going to particulat app dir and issueing mm command then use this command.
make app_name.apk -j4

3. Power Menu and Lock screen
make android.policy

4. Framework Changes
make framework (the initial framework files)
make framework-res (the initial framework resources)

5. Update the services changes

make services (the services.jar file)

6. Android SDK build
make sdk (builds the android sdk)

7. Build all Modules
make modules (builds all modules)

8. Build clean or fresh
make installclean (removes all staging directories out/target/product/boardname/system)
make clean (removes the whole /out directory)
make recoveryimage (builds the recovery from /bootable/recovery, customizable if wanted!)

9. Build with latest changes only
make snod - build the system image from the current software binaries

10. Build Everything
make all - make everything, whether it is included in the product definition or not


11. Updating the API
The build systems has safeguards in case you modify the AOSP’s core API. If you do,
the build will fail by default with a warning such as this
You have tried to change the API from what has been previously approved
make update-api


Some macros and functions
There are some helper macros and functions that are installed when we set envsetup.sh. Following are most used one :-

- execute 'make' from the top of the tree (even if your current directory is somewhere else)

mm - Builds all of the modules in the current directory, but not their dependencies

mmm <dir1> - Builds all of the modules in the supplied directories, but not their dependencies

mma - Builds all of the modules in the current directory, and their dependencies.

mmma <dir> - Builds all of the modules in the supplied directories, and their dependencies

mm -B : Rebuild the module even it hasn’t any changes.


Some Most used ADB/Fastboot Commands

1. Basic information about devices connected
adb devices


2. Reboot your Device
adb reboot
This command reboots device in normal mode.

3. Reboot into Recovery
adb reboot recovery
Reboot your device into recovery mode, say for flashing a custom ROM.If you have flashed a custom recovery on your device, you will be taken to the same instead of the stock recovery

4. Reboot into Bootloader Mode
adb reboot bootloader
reboot your device into bootloader mode. That is where you can unlock your bootloader, reboot into fastboot and recovery mode, and do some other tasks .

5. Rebbot in Fastboot mode

adb reboot fastboot
it will take your device directly to fastboot mode. The fastboot mode helps you flash custom recoveries as well as custom ROMs on your device

6. Send File to your Device
adb push Source file Destination folder

7. Get File from your Device
adb pull FileLocation Destination folder

8. Install an App on your Device
adb install APKLocation

9. Remount the System
adb remount

10. Get logs of connected device

adb logcat

11. Capture Bugreport

adb bugreport
Shows three element on the screen: dump sys, dump state and logcat data

12. Start ADB server
adb start-server
Starts the ADB server process

12. Stops the ADB server
adb kill-server
Kill the current running ADB server

13. Lunch Remote Shell
adb shell
Launches remote shell console for connected device

14. Help
adb help
Displays the help contents for ADB


15. Sqlite command-line
adb -s emulator-5554 shell (hit enter key)
sqlite3 path of DB
# /data/data/com.example.google.rss.rssexample/databases/rssitems.db
SQLite version 3.3.12
Enter ".help" for instructions
.... enter commands, then quit...
# sqlite> .exit
Use the sqlite3 command-line program to manage SQLite databases created by Android applications

Thanks
Saurabh
Happy Coding...

2 comments:

  1. hello,
    i just want to say that you have clearly mention the process very clearly and i also found it is very much easy to understand. keep sharing.

    iphone app development company in chennai

    ReplyDelete
  2. This information is very useful and attractive. Those who need this information, it's very informative and understandable for those all. Thanks for this information. Aniruddh Agarwal

    ReplyDelete

Build a Custom Kernel Module for Android

Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...