Precompiled Tcpdump binaries for Android are provided for ARM, ARM64, X86, X86-64. Download from releases.
Tcpdump version: 4.9.2
Libpcap version: 1.9.0
Default android API: 23
-
Download the Android NDK from https://developer.android.com/ndk/downloads/. Extract the zip to a suitable location.
$ wget https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip
-
Clone the repository
$ git clone https://github.com/extremecoders-re/tcpdump-android-builds.git $ cd tcpdump-android-builds
-
For compiling, set
NDK
to the location of the android sdk directory and run the corresponding build script.$ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ ./build_x86.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ ./build_x86_64.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ ./build_arm.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ ./build_arm64.sh
-
Compiled binaries will be located in the corresponding
tcpdumpbuild
directory.
You can use the build_libpcap_all.sh
script to run the scripts mentioned above for multiple targets and Android API versions.
This can be useful if you need to buid libpcap for multiple targets / API versions.
-
Run the script
build_libpcap_all.sh
and setNDK
to the location of the android sdk directory. -
You can also specify the following parameters:
OUTPUT_DIR
for the output directory. The default islibpcap_all_targets
.TARGETS
one or more targets from this list:arm arm64 x86 x86_64
. The default is all of them.API_MIN
min API version. The default is 21.API_MAX
max API version. The default is 30.
- Examples:
$ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ ./build_libpcap_all.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ OUTPUT_DIR=my_dir ./build_libpcap_all.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ TARGETS="x86 x86_64" ./build_libpcap_all.sh $ NDK=/home/ubuntu/workspace/android-ndk-rxxx/ API_MIN=21 API_MAX=30 /build_libpcap_all.sh