IPerf3 execution from Android 7
https://stackoverflow.com/questions/40975003/iperf3-execution-from-android-7-doesnt-work
I found your question and it helped me to build iperf3 for Android, but I reached on same problem.
Are you using build toolchains from Ubuntu repository? If yes, built binaries it will not work on Android 7.0, because they are using an old version of build toolchains. You will need to build the binaries with most recent NDK version. (now is r13b)
How I solved it:
-Putted all iperf3 sources from src folder on jni folder
-Created Android.mk and Application.mk, which I'll post below, on same folder, along with other files.
-Inside jni folder, I ran ndk-build and, voila, all binaries on /libs folder, working even on Android 7.0 (pick the binaries, put on assets folder and implement your strategy to load the correct binary for the right abi, or just get armeabi binary and load
into your app)
Tip: iperf3 uses an folder to cache the results which is inaccessible for Android. You'll need to change this folder to work:
https://github.com/esnet/iperf/blob/670c18584bcf7a285f3561eb7ea38cc53600d0ab/src/iperf_api.c#L2621
Android.mk: (I think that is not necessary to put .h files on this script)
http://pastebin.com/fPsn0wsD
Application.mk:
http://pastebin.com/sgSsGNqB
I recommend to use ndk-build to build library to make more easier to build iperf3 for different architectures, like x86.
iperf3 - Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
LOCAL_MODULE := iperf3
LOCAL_SRC_FILES := cjson.c \
cjson.h \
flowlabel.h \
iperf.h \
iperf_api.c \
iperf_api.h \
iperf_error.c \
iperf_client_api.c \
iperf_locale.c \
iperf_locale.h \
iperf_server_api.c \
iperf_tcp.c \
iperf_tcp.h \
iperf_udp.c \
iperf_udp.h \
iperf_sctp.c \
iperf_sctp.h \
iperf_util.c \
iperf_util.h \
main.c \
net.c \
net.h \
portable_endian.h \
queue.h \
tcp_info.c \
tcp_window_size.c \
tcp_window_size.h \
timer.c \
timer.h \
units.c \
units.h \
version.h
include $(BUILD_EXECUTABLE)
iperf3 - Application.mk:
APP_ABI := all
APP_PLATAFORM := android-16
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通