Android NDK + adb调试

Android.mk

  • 每个模块前必须加上include $(CLEAR_VARS),比如

    include $(CLEAR_VARS)
    LOCAL_MODULE:=libcwauthorize_android
    LOCAL_SRC_FILES:=C:/Users/Administrator/Desktop/DeepNet_expression/lib/Android/arm64-v8a/libcwauthorize_android.a
    include $(PREBUILT_STATIC_LIBRARY)
    include $(CLEAR_VARS)

  • 每个模块对应的APP_STL必须一致

    遇到的坑是底层库是APP_STL := gnustl_static,上层库是APP_STL := c++_static 。

adb调试

  • 在pc端编写adb调试程序test.bat
@echo off
@echo Android Autotest Bat 
@echo                  ------made by Zhangdanfeng 
@echo -----------------------------------WINDOWS BAT-----------------------------------
cd C:\Users\Administrator\Desktop\DeepNet_expression\libs\arm64-v8a
@echo copying main...
adb push main /data/local/tmp

cd C:\Users\Administrator\Desktop\DeepNet_expression
@echo copying images...
adb push 10.jpg /data/local/tmp
adb push 11.jpg /data/local/tmp
adb push 14.jpg /data/local/tmp


cd C:\Users\Administrator\Desktop\DeepNet_expression\jni
@echo -----------------------------------LINUX SHELL------------------------------------
adb shell
  • 在pc端编写设备端shell程序adbshell.txt
cd /data/local/tmp
export LD_LIBRARY_PATH=./ 
chmod 777 main

./main

rm -rf ./*
exit

你可能感兴趣的:(Note)