You’re almost there — sign up to start building in Notion today.
Sign up or login
Setup Environments

Setup Environments

What we need?

An Android Emulator or Real device.
How to Connect to emulator or device?
WiFi (May face to some bugs)(Not recommended)
USB (This one is absolutely better)
Android Studio
SDK 30,31,32
NDK
Android SDK Command-Line Tools (ADB, fastboot)
CMake
Android Emulator
Plugins
Java2Smali
Visual Stadio Code
Plugins
Smali Language Support
APKLab
JADx
APKTool
APKEditor

Note

To adding platform-tools to the system path:
vim ~/.zshrc export PATH=$PATH:/home/app/Android/Sdk/platform-tools/: # IN macOS /Users/hossein/Library/Android/sdk/platform-tools/

Note

To adding SDK-Tools to the system path:
vim ~/.zshrc export PATH=$PATH:/home/app/Android/Sdk/build-tools/32.0.0/:

Note

To refresh you environment variable for current terminal:
source ~/.zshrc

What we can do with USB connection?

Using Android Debug Bridge (ADB) or Java Debug Wire Protocol(JWDP)
We can use GNU Project Debugger (GNU)
Frida
💡 Callout icon
GNU is an extensive collection of free software, which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operating systems popularly known as Linux. Most of GNU is licensed under the GNU Project's own General Public License.

Don’t own a real device?

No problem you can use one these solutions:
Using an emulator
Android VDM (Virtual Device Manager)
Genymotion
Nox
Using a virtual machine (VM)

Real Android Phone via Emulator/VM

Real Device
Features
Emulator/VM
Depends on Model
Root Access
YES
YES
Performance
Depends on Host resources
YES
Platform Support
In ARM based apps it’s slow
YES
Smartphone Features(SMS,…)
It depends
It depends on device support
Up to Date
YES
Depends on device model
Price
Usually Free

Working with VDM (Virtual Device Manager)

You can access Virtual Device Manager(VDM) from two ways:
Open android studio → More actions → Virtual Device Management
Open /home/app/Android/Sdk/emulator/emulator
Adding emulator to the system PATH
emulator -list-avds
emulator @Nexus5
To proxy android traffic don’t use WiFi settings. Because it just send WiFi traffic to proxy. Alternatively use VDM → Settings → Proxy.
To create macro or load it: VDM → Record and Playback. Macro is multiple steps which you record and play it back. It usually use to automating UI Tasks like doing something repetitive in games.

VDM Secret Features

In this part we want to access
qemu
process which is emulation framework for VDM.
Finding the port
netstat -tulpen
💡 Callout icon
The 
netstat
 command will display a list of all open network connections on your Linux, including the local and remote addresses, the protocol used, and the state of the connection. The 
-t
 option specifies that only TCP connections should be displayed, the 
-u
 option specifies that only UDP connections should be displayed, the 
-l
 option specifies that only listening connections should be displayed, the 
-p
 option specifies that the process ID and name should be displayed for each connection, the 
-e
 option specifies that extended information should be displayed for each connection, and the 
-n
 option specifies that numeric addresses should be displayed instead of hostnames
💡 Callout icon
The 5555 port is used for default ADB port.
Connecting
telnet 127.0.0.1 5554
Getting access token
cat /home/app/.emulator_console_auth_token
Connecting and authenticate
telnet 127.0.0.1 5554 auth [secret_key]
Run your command. Example:
geo fix [lat] [lang]
automation record # Macro automation stop-record # Stop recording macro automation play # Running macro automation stop-play # Stop playing macro

More info

Installing Android On VMware

Create new VM in VMware.
Add the ISO and install it.
For graphic support you should do these steps:
mount -o remount,rw /mnt cd /mnt/grub vi menu.lst # Add this kernel parameter in first line to running android via GUI nomodset xforcevesa