概述
一、最简单的NDK编译
最简单的方式,网上很多介绍,按以下几个步骤即可。1、在要打印的源文件(c或c++源文件)加入#include <android/log.h>,及宏定义
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,"yourTAGStr", __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,"yourTAGStr", __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "yourTAGStr", __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, "yourTAGStr", __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,"yourTAGStr", __VA_ARGS__)
2、Android.mk中加入LOCAL_LDLIBS+= -llog
3、在你需要打印的地方加入:如LOGE("jni log test"); 或LOGE("jni log test %d",12); LOGE打印出来的显示在logcat中为红色
补充:
android_LogPriority枚举类型,如下所示: typedef enum android_LogPriority { ANDROID_LOG_UNKNOWN = 0, ANDROID_LOG_DEFAULT, ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL, ANDROID_LOG_SILENT, } android_LogPriority;
也可以不使用宏定义,直接打印如:__android_log_print(ANDROID_LOG_ERROR, "yourTAGStr", "jni log test");
二、底层库中链接第三方库,在第三方库中加调试信息
如果你的底层库需要链接第三方库,你也需要在第三方库源码中加打印,先看你的第三方库使用NDK编译的还是用./configure、make编译(可以这样理解:NDK/ndk-build是GNU Make的一个子集),如果使用NDK编译,那么直接使用上面第一种方式加入打印,如果不是,可参考以下我的做法。我的底层库是libpj_video_android.so,使用NDK编译,需要加入ffmpeg库,ffmpeg使用./configure、make方式编译。
include $(CLEAR_VARS)
LOCAL_MODULE := pj_video_android
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../webrtc/sources/modules/video_render/main/interface
$(LOCAL_PATH)/../../../webrtc/sources/modules/video_capture/main/interface
$(LOCAL_PATH)/../../../webrtc/sources/modules/interface
$(LOCAL_PATH)/../../../webrtc/sources/system_wrappers/interface
$(LOCAL_PATH)/../../../webrtc/sources/modules
$(LOCAL_PATH)/../../../webrtc/sources
$(LOCAL_PATH)/../pjlib/include $(LOCAL_PATH)/../pjlib-util/include
$(LOCAL_PATH)/../pjsip/include
$(LOCAL_PATH)/../pjnath/include $(LOCAL_PATH)/include $(LOCAL_PATH)/..
# We depends on csipsimple at this point because we need service to be stored somewhere
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../android_sources/pjmedia/include/pjmedia-videodev
$(LOCAL_PATH)/../../../swig-glue
$(LOCAL_PATH)/../../../csipsimple-wrapper/include
# Ffmpeg codec depend on ffmpeg
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../ffmpeg/ffmpeg_src
# Pj implementation for renderer
LOCAL_SRC_FILES += $(PJ_ANDROID_SRC_DIR)/pjmedia-videodev/webrtc_android_render_dev.cpp
# Pj implementation for capture
LOCAL_SRC_FILES += $(PJ_ANDROID_SRC_DIR)/pjmedia-videodev/webrtc_android_capture_dev.cpp
# Ffmpeg codec
LOCAL_SRC_FILES += $(PJMEDIACODEC_SRC_DIR)/ffmpeg_vid_codecs.c
$(PJLIB_SRC_DIR)/converter_libswscale.c
$(PJLIB_SRC_DIR)/ffmpeg_util.c
$(PJMEDIACODEC_SRC_DIR)/h263_packetizer.c
$(PJMEDIACODEC_SRC_DIR)/h264_packetizer.c
$(PJLIB_SRC_DIR)/vid_codec_util.c
# For render and capture
LOCAL_STATIC_LIBRARIES += libwebrtc_video_render libwebrtc_video_capture
# Common webrtc utility
LOCAL_STATIC_LIBRARIES += libwebrtc_yuv libyuv libwebrtc_apm_utility
libwebrtc_system_wrappers libwebrtc_spl
# Ffmpeg codec
BASE_FFMPEG_BUILD_DIR := $(LOCAL_PATH)/../../../ffmpeg/build/ffmpeg/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_FFMPEG_BUILD_DIR)/libavcodec.a
$(BASE_FFMPEG_BUILD_DIR)/libavformat.a
$(BASE_FFMPEG_BUILD_DIR)/libswscale.a
$(BASE_FFMPEG_BUILD_DIR)/libavutil.a
# Add X264
BASE_X264_BUILD_DIR := $(LOCAL_PATH)/../../../ffmpeg/build/x264/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_X264_BUILD_DIR)/libx264.a
# Add ffmpeg to flags for pj part build
LOCAL_CFLAGS := $(MY_PJSIP_FLAGS) -DWEBRTC_ANDROID
-DPJMEDIA_HAS_FFMPEG=1
-DPJMEDIA_HAS_FFMPEG_CODEC=1
-DPJMEDIA_HAS_FFMPEG_CODEC_H264=1
LOCAL_SHARED_LIBRARIES += libpjsipjni
LOCAL_LDLIBS += -lGLESv2 -llog
LOCAL_STATIC_LIBRARIES += libgcc cpufeatures
USE_STAGEFRIGHT_H264:=0
ANDROID_LIBS := ./jni/ffmpeg/ffmpeg_src/android-libs
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
ifeq ($(USE_STAGEFRIGHT_H264),1)
LOCAL_LDLIBS += -L$(ANDROID_LIBS) -Wl,-rpath-link,$(ANDROID_LIBS) -lstagefright -lutils -lbinder
endif
endif
include $(BUILD_SHARED_LIBRARY)
在ffmpeg库中加入打印信息并且在logcat查看,不能使用第一种方式,但是原理其实是一样的,都是要利用Android提供的log机制,即都要链接使用
android-ndk-r8e/platforms/android-14/arch-arm/usr/lib/liblog.so(android-ndk-r8e是我使用的NDK版本),那在ffmpeg库中怎么链接liblog.so呢?
1、在我的ffmpeg根目录下,放入jni_log文件夹,放进liblog.so及相应头文件。
2、在./configure后加入liblog.so的路径并指定链接该库
脚本build_ffmpeg.sh是控制ffmpeg编译的,我在其中加入
build_ffmpeg.sh:
#!/bin/bash
pushd `dirname $0`
TARGET_ARCH_ABI=$1
DEST=`pwd`/build/ffmpeg
ANDROID_API_LEVEL=9
minimal_featureset=1
USE_STAGEFRIGHT=0
NDK_ROOT=$(dirname $(which ndk-build))
ndk_gcc_res=$(ndk-build -n -C $NDK_ROOT/samples/hello-jni NDK_LOG=1 APP_ABI=$TARGET_ARCH_ABI APP_PLATFORM=android-$ANDROID_API_LEVEL | grep gcc)
NDK_CROSS_PREFIX=$(echo $ndk_gcc_res | awk '{ print $1 }' | sed 's/gcc//')
NDK_SYSROOT=$(echo $ndk_gcc_res | sed 's/^.*-I([^ ]*)/usr/include .*$/1/')
FLAGS="--cross-prefix=$NDK_CROSS_PREFIX"
case "$TARGET_ARCH_ABI" in
x86)
FLAGS="$FLAGS --enable-pic --target-os=linux --arch=x86 --disable-asm "
;;
mips)
FLAGS="$FLAGS --target-os=linux --arch=mips --disable-asm "
;;
armeabi-v7a)
FLAGS="$FLAGS --enable-pic --target-os=linux --arch=arm --cpu=armv7-a"
;;
armeabi)
FLAGS="$FLAGS --enable-pic --target-os=linux --arch=arm "
;;
esac
pushd ffmpeg_src
ANDROID_SOURCE=./android-source
ANDROID_LIBS=./android-libs
# stagefright only for armeabi-v7a
if [[ "$TARGET_ARCH_ABI" != "armeabi-v7a" ]]; then
USE_STAGEFRIGHT=0
fi
if [ $USE_STAGEFRIGHT -eq 1 ]; then
if [ ! -d "$ANDROID_SOURCE/frameworks/base" ]; then
echo "Fetching Android system base headers"
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_frameworks_base.git $ANDROID_SOURCE/frameworks/base
fi
if [ ! -d "$ANDROID_SOURCE/system/core" ]; then
echo "Fetching Android system core headers"
git clone --depth=1 --branch gingerbread-release git://github.com/CyanogenMod/android_system_core.git $ANDROID_SOURCE/system/core
fi
if [ ! -d "$ANDROID_LIBS" ]; then
# Libraries from any froyo/gingerbread device/emulator should work
# fine, since the symbols used should be available on most of them.
echo "Fetching Android libraries for linking"
if [ ! -f "./update-cm-7.0.3-N1-signed.zip" ]; then
wget http://download.cyanogenmod.com/get/update-cm-7.0.3-N1-signed.zip -P./
fi
unzip ./update-cm-7.0.3-N1-signed.zip system/lib/* -d./
mv ./system/lib $ANDROID_LIBS
rmdir ./system
fi
fi
# actual build
FLAGS="$FLAGS --sysroot=$NDK_SYSROOT"
FLAGS="$FLAGS --disable-shared --disable-symver"
FLAGS="$FLAGS --disable-everything"
#FLAGS="$FLAGS --enable-small"
FLAGS="$FLAGS --enable-gpl"
FLAGS="$FLAGS --enable-runtime-cpudetect"
# For h263
FLAGS="$FLAGS --enable-decoder=h263 --enable-encoder=h263"
#For x264
FLAGS="$FLAGS --enable-encoder=libx264 --enable-parser=h264"
FLAGS="$FLAGS --enable-libx264"
if [ $USE_STAGEFRIGHT -eq 1 ]; then
FLAGS="$FLAGS --enable-libstagefright-h264 --enable-decoder=libstagefright_h264"
else
FLAGS="$FLAGS --enable-decoder=h264"
fi
X264_LIBS=../build/x264/$TARGET_ARCH_ABI/lib
X264_INCLUDES=../build/x264/$TARGET_ARCH_ABI/include
ABI=$TARGET_ARCH_ABI
case "$TARGET_ARCH_ABI" in
neon)
# --- THIS IS NEVER USED FOR NOW ---
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--fix-cortex-a8"
# Runtime choosing neon vs non-neon requires
# renamed files
ABI="armeabi-v7a-neon"
;;
armeabi-v7a)
EXTRA_CFLAGS="$EXTRA_CFLAGS -march=armv7-a -mfloat-abi=softfp"
;;
esac
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
# CXX
EXTRA_CXXFLAGS="-Wno-multichar -fno-exceptions -fno-rtti"
X264 libs and includes
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$X264_INCLUDES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$X264_LIBS -Wl,-rpath-link,$X264_LIBS"
# Stagefright
if [ $USE_STAGEFRIGHT -eq 1 ]; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include -I$ANDROID_SOURCE/system/core/include"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/media/libstagefright"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$ANDROID_SOURCE/frameworks/base/include/media/stagefright/openmax"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$NDK_ROOT/sources/cxx-stl/system/include"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ANDROID_LIBS -Wl,-rpath-link,$ANDROID_LIBS"
fi
#20141125 lyn add log to ffmpeg
LOG_LIBS=../jni_log/lib
LOG_INCLUDES=../jni_log/include
EXTRA_CFLAGS="$EXTRA_CFLAGS -I$LOG_INCLUDES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$LOG_LIBS -llog"
mkdir -p $DEST
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt
make clean
make -j4 || exit 1
make install || exit 1
popd; popd
在./configure后加入链接liblog及头文件的参数(configure是根据配置信息生成makefile,通过查看ffmpeg_src目录下的configure文件,--extra-ldflags参数改动的其实是LDFLAGS参数),./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" --extra-cxxflags="$EXTRA_CXXFLAGS" | tee $DEST/configuration.txt。
3、在ffmpeg源文件中加头文件,宏定义及打印信息
我在ffmpeg_src/libavcodec/libx264.c中加入
#include "../jni_log/include/log.h"//lyn
//#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "libpj_video_android", __VA_ARGS__)
//#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "libpj_video_android", __VA_ARGS__)
//#define LOGI(...) __android_log_print(ANDROID_LOG_INFO , "libpj_video_android", __VA_ARGS__)
//#define LOGW(...) __android_log_print(ANDROID_LOG_WARN , "libpj_video_android", __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , "libpj_video_android", __VA_ARGS__)
在想打印的地方加入:
LOGE("ffmpeg-android-log-test=%d",123);或LOGE("ffmpeg-android-log-test");
编译结束后,需要链接,若出__android_log_print未定义的错误,则说明没有把liblog.so链接进去。
三、有的开源库编译,configure并没有提供--extra-ldflags参数让你链接其他库,这时该怎么办呢?
如我在ffmpeg库中加入vpx库,想在vpx源码中加打印,vpx_src/build/make/configue.sh并没有提供--extra-ldflags。
configure.sh:
show_help_pre(){
for opt in ${CMDLINE_SELECT}; do
opt2=`echo $opt | sed -e 's;_;-;g'`
if enabled $opt; then
eval "toggle_${opt}="--disable-${opt2}""
else
eval "toggle_${opt}="--enable-${opt2} ""
fi
done
cat <<EOF
Usage: configure [options]
Options:
Build options:
--help print this message
--log=yes|no|FILE file configure log is written to [config.log]
--target=TARGET target platform tuple [generic-gnu]
--cpu=CPU optimize for a specific cpu rather than a family
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
${toggle_extra_warnings} emit harmless warnings (always non-fatal)
${toggle_werror} treat warnings as errors, if possible
(not available with all compilers)
${toggle_optimizations} turn on/off compiler optimization flags
${toggle_pic} turn on/off Position Independent Code
${toggle_ccache} turn on/off compiler cache
${toggle_debug} enable/disable debug mode
${toggle_gprof} enable/disable gprof profiling instrumentation
${toggle_gcov} enable/disable gcov coverage instrumentation
${toggle_thumb} enable/disable building arm assembly in thumb mode
Install options:
${toggle_install_docs} control whether docs are installed
${toggle_install_bins} control whether binaries are installed
${toggle_install_libs} control whether libraries are installed
${toggle_install_srcs} control whether sources are installed
EOF
}
解决方法:
修改configure.sh,加入--extra-ldflags接口说明及相应功能:
1、show_help_pre()中加入:“--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS”
2、process_common_cmdline()中加入:
--extra-ldflags=*)
LDFLAGS="$LDFLAGS ${optval}"
;;
show_help_pre(){
for opt in ${CMDLINE_SELECT}; do
opt2=`echo $opt | sed -e 's;_;-;g'`
if enabled $opt; then
eval "toggle_${opt}="--disable-${opt2}""
else
eval "toggle_${opt}="--enable-${opt2} ""
fi
done
cat <<EOF
Usage: configure [options]
Options:
Build options:
--help print this message
--log=yes|no|FILE file configure log is written to [config.log]
--target=TARGET target platform tuple [generic-gnu]
--cpu=CPU optimize for a specific cpu rather than a family
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS
${toggle_extra_warnings} emit harmless warnings (always non-fatal)
${toggle_werror} treat warnings as errors, if possible
(not available with all compilers)
${toggle_optimizations} turn on/off compiler optimization flags
${toggle_pic} turn on/off Position Independent Code
${toggle_ccache} turn on/off compiler cache
${toggle_debug} enable/disable debug mode
${toggle_gprof} enable/disable gprof profiling instrumentation
${toggle_gcov} enable/disable gcov coverage instrumentation
${toggle_thumb} enable/disable building arm assembly in thumb mode
Install options:
${toggle_install_docs} control whether docs are installed
${toggle_install_bins} control whether binaries are installed
${toggle_install_libs} control whether libraries are installed
${toggle_install_srcs} control whether sources are installed
EOF
}
process_common_cmdline() {
for opt in "$@"; do
optval="${opt#*=}"
case "$opt" in
--child) enable_feature child
;;
--log*)
logging="$optval"
if ! disabled logging ; then
enabled logging || logfile="$logging"
else
logfile=/dev/null
fi
;;
--target=*) toolchain="${toolchain:-${optval}}"
;;
--force-target=*) toolchain="${toolchain:-${optval}}"; enable_feature force_toolchain
;;
--cpu)
;;
--cpu=*) tune_cpu="$optval"
;;
--extra-cflags=*)
extra_cflags="${optval}"
;;
--extra-ldflags=*)
LDFLAGS="$LDFLAGS ${optval}"
;;
--enable-?*|--disable-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
if echo "${ARCH_EXT_LIST}" | grep "^ *$option$" >/dev/null; then
[ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
elif [ $action = "disable" ] && ! disabled $option ; then
echo "${CMDLINE_SELECT}" | grep "^ *$option$" >/dev/null ||
die_unknown $opt
elif [ $action = "enable" ] && ! enabled $option ; then
echo "${CMDLINE_SELECT}" | grep "^ *$option$" >/dev/null ||
die_unknown $opt
fi
${action}_feature $option
;;
--require-?*)
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
if echo "${ARCH_EXT_LIST}" none | grep "^ *$option$" >/dev/null; then
RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
else
die_unknown $opt
fi
;;
--force-enable-?*|--force-disable-?*)
eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'`
${action}_feature $option
;;
--libc=*)
[ -d "${optval}" ] || die "Not a directory: ${optval}"
disable_feature builtin_libc
alt_libc="${optval}"
;;
--as=*)
[ "${optval}" = yasm -o "${optval}" = nasm -o "${optval}" = auto ]
|| die "Must be yasm, nasm or auto: ${optval}"
alt_as="${optval}"
;;
--prefix=*)
prefix="${optval}"
;;
--libdir=*)
libdir="${optval}"
;;
--sdk-path=*)
[ -d "${optval}" ] || die "Not a directory: ${optval}"
sdk_path="${optval}"
;;
--libc|--as|--prefix|--libdir|--sdk-path)
die "Option ${opt} requires argument"
;;
--help|-h) show_help
;;
*) die_unknown $opt
;;
esac
done
}
接着根据第二种方式操作即可。
总结:通过上述方法,可以在Android底层中的任何地方加入你要的调试信息。
注意:有时发现加了调试信息,重新编译后并没有把所加信息打印出来,可能是因为总库(libpj_video_android.so)链接的还是原来的静态库(如libavcodec.a),记得在ffmpeg中make clean并删除总库重新生成。
四、补充(以下内容是转的)
1、NDK链接第三方静态库的方法:
将NDK编译的第三方静态拷贝到JNI目录下,在Android.mk中添加如下代码
以openssl静态库(libcrypto-static.a)为例
第一种链接方法:LOCAL_LDFLAGS := libcrypto-static.a
第二种链接方法:LOCAL_LDLIBS := libcrypto-static.a
第三种链接方法:
include $(CLEAR_VARS)
LOCAL_MODULE := third_static_lib (可以随便起一个名字)
LOCAL_SRC_FILES := libcrypto-static.a
include $(PREBUILT_STATIC_LIBRARY)
//在你要编译的模块中引用third_static_lib
LOCAL_STATIC_LIBRARIES := third_static_lib
2、android开发 NDK 编译和使用静态库、动态库
a、在eclipse工程目录下建立一个jni的文件夹。
b、在jni文件夹中建立Android.mk和Application.mk文件。
Android.mk文件:
Android提供的一种makefile文件,用来指定诸如编译生成so库名、引用的头文件目录、需要编译的.c/.cpp文件和.a静态库文件等。
Application.mk文件:
定义了项目的一些细节,比如APP_ABI := x86(编译X86平台库)、APP_PLATFORM := android-9(使用android-9以上的平台库)。
用cd命令移至jni目录,运行/mnt/500G/public/NDK/android-ndk-r7b/ndk-build命令,这时命令行中可能会出现编译错误,比如头文件找不到,函数找不到等等,细心找找就能改掉。
编译成功后,在工程目录下libs/x86中就会生成你想要的.so库。
NDK 编译和使用静态库、动态库
情况一:编译静态库
情况二:编译动态库
情况三:编译动态库+静态库
情况四:已有第三方静态库(动态库),编译静态库(动态库)
默认所有代码和文件在$project/jni下,否则特殊说明。
情况一:编译静态库
文件Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-jni
LOCAL_SRC_FILES := hello-jni.c
include $(BUILD_STATIC_LIBRARY)
文件Application.mk:
APP_MODULES :=hello-jni
情况二:编译动态库
文件Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-jni
LOCAL_SRC_FILES := hello-jni.c
include $(BUILD_SHARED_LIBRARY)
情况三:编译动态库+静态库
文件Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib_static
LOCAL_SRC_FILES := src.c
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib_shared
LOCAL_SRC_FILES := src2.c
LOCAL_STATIC_LIBRARIES := mylib_static
include $(BUILD_SHARED_LIBRARY)
情况四:已有第三方静态库(动态库),编译静态库(动态库)
文件Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := thirdlib1 # name it whatever
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libthird1.a # or $(so_path)/libthird1.so
#LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY) #or PREBUILT_SHARED_LIBRARY
include $(CLEAR_VARS)
LOCAL_MODULE := mylib_use_thirdlib
LOCAL_SRC_FILES := src.c
LOCAL_STATIC_LIBRARIES := thirdlib1 #or LOCAL_SHARED_LIBRARY
include $(BUILD_SHARED_LIBRARY) #如果编译静态库,需要Application.mk
最后
以上就是香蕉石头为你收集整理的Android底层库打印调试信息到logcat中查看的全部内容,希望文章能够帮你解决Android底层库打印调试信息到logcat中查看所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复