zoukankan      html  css  js  c++  java
  • 编译JNI动态库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_LDLIBS := -L$(SYSROOT)/usr/lib -llog
    LOCAL_SHARED_LIBRARIES += \
                              libcutils libutils
    LOCAL_MODULE_TAGS := optional eng
    include $(BUILD_SHARED_LIBRARY) 
    	出现过错误:添加
     
    LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
    LOCAL_SHARED_LIBRARIES += \
                              libcutils libutils

    后问题解决 PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.0.4TARGET_PRODUCT=msm8x25_y300TARGET_BUILDSPEC=TARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-a-neonHOST_ARCH=x86HOST_OS=linuxHOST_BUILD_TYPE=releaseBUILD_ID=IMM76I============================================No private recovery resources for TARGET_DEVICE msm8x25_y300make: Entering directory `/home/yuanwei/code/8x25'target SharedLib: serial_port (out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/LINKED/serial_port.so)prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/SerialPort.o: in function Java_android_1serialport_1api_SerialPort_close:external/serial/SerialPort.c:168: error: undefined reference to '__android_log_print'prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/SerialPort.o: in function Java_android_1serialport_1api_SerialPort_open:external/serial/SerialPort.c:101: error: undefined reference to '__android_log_print'prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/SerialPort.o: in function Java_android_1serialport_1api_SerialPort_open:external/serial/SerialPort.c:103: error: undefined reference to '__android_log_print'prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/SerialPort.o: in function Java_android_1serialport_1api_SerialPort_open:external/serial/SerialPort.c:117: error: undefined reference to '__android_log_print'collect2: ld returned 1 exit statusmake: *** [out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/LINKED/serial_port.so] Error 1结果:No private recovery resources for TARGET_DEVICE msm8x25_y300make: Entering directory `/home/yuanwei/code/8x25'target SharedLib: serial_port (out/target/product/msm8x25_y300/obj/SHARED_LIBRARIES/serial_port_intermediates/LINKED/serial_port.so)target Symbolic: serial_port (out/target/product/msm8x25_y300/symbols/system/lib/serial_port.so)target Strip: serial_port (out/target/product/msm8x25_y300/obj/lib/serial_port.so)Install: out/target/product/msm8x25_y300/system/lib/serial_port.so


    生成了serial_port.so并改为libserial_port.so 后打包到APK的libs/armeabi 目录下。

  • 相关阅读:
    pandas模块篇(终章)及初识mataplotlib
    pandas模块篇(之三)
    pandas模块篇(之二)
    numpy最后一部分及pandas初识
    anaconda及jupyter notebook的使用之numpy模块的用法(2)
    anaconda及jupyter notebook的了解及使用方法(1)
    python初略复习(2)及python相关数据分析模块的介绍
    Python回顾笔记(此讲大致说明,详情请看之前的笔记)
    Python第三讲
    折半算法
  • 原文地址:https://www.cnblogs.com/yuzaipiaofei/p/4124131.html
Copyright © 2011-2022 走看看