Android串口调试 libserial_port.so: has text relocations

遇到问题:Android 串口调试 libserial_port.so: has text relocations

解决方法 1

在 Android.mk 文件中加入:LOCAL_LDFLAGS += -fPIC,重新编译 Google 开源库的源码,生成.so 库

    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    TARGET_PLATFORM := android-3
    LOCAL_MODULE    := serial_port
    LOCAL_SRC_FILES := SerialPort.c
    LOCAL_LDLIBS    := -llog

    #加入如下信息
    LOCAL_LDFLAGS += -fPIC

    include $(BUILD_SHARED_LIBRARY)

重新编译好的.so 库

但是我没找到 Android.mk 文件

只好下载重新编译好的然后直接放进去替换:
下载附件

解决方法二

module 下的 build.gradle 把 targetSdkVersion 改为 22 以下(也就是 Android 6.0 以下版本);

posted @ 2023-08-18 11:25  第9527号嵌入式菜鸟  阅读(396)  评论(0编辑  收藏  举报