这是我的shell脚本内容
# Set the NDK path and the toolchain
NDK_PATH="/home/pis/work/ndk/android-ndk-r25b"
TOOLCHAIN="$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64"
# Set the target ABI and API level
TARGET_ABI="arm64-v8a"
ANDROID_API_LEVEL=29
BUILD_TYPE="release"
# Set the output directory
OUTPUT_DIR="./android/"
# Set the source file and library name
SOURCE_FILE="./main.c"
LIB_NAME="libmylib.so"
$TOOLCHAIN/bin/clang $CFLAGS -I./include/test/ -target aarch64-none-linux-android21 -isysroot $NDK_PATH/sysroot -I$NDK_PATH/sysroot/usr/include -I$NDK_PATH/sysroot/usr/include/$TARGET_ABI -o "$OUTPUT_DIR/$LIB_NAME" $SOURCE_FILE $LDFLAGS
这张图是我目录结构,头文件在haha/include/test/下面,我现在执行脚本能成功编译动态so库。但是安卓调用的时候,老是报找不到方法的错误
shell 命令编译不懂,不过应该和你CMakeLists 配置有些关系,在cmake 里面需要将你的so库链接起来