NDK HOWTO
16lz
2021-01-26
如何使用java的NDK轻松调用C或者C++函数库
一 Android添加自己的动态库
在 build/core/prelink-linux-arm.map 或者build/core/prelink-linux-mips.map 加入自己的动态库的定义
二
原文网址:http://macholad-hotmail-com.javaeye.com/blog/889022
android编译时添加库第三方库文件
android/customization/custom_normal/vendor/third-party/libs/Android_cust.mk 中
include $(CLEAR_VARS)LOCAL_PREBUILT_LIBS += libhello-jni.so include $(BUILD_MULTI_PREBUILT)在上述mk文件中添加上述代码 可以在编译时将
android/customization/custom_normal/vendor/third-party/libs/libhello-jni.so 库文件添加到android系统库目录中
三
1 进入工程的目录然后使用 $(NDK)/ndk-build
ubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni$ pwd/home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jniubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni$ ../../ndk-build -B v=1Gdbserver : [arm-eabi-4.4.0] /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni/libs/armeabi/gdbserverGdbsetup : /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni/libs/armeabi/gdb.setupGdbsetup : + source directory /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni/jniCompile thumb : hello-jni <= /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni/jni/hello-jni.cSharedLibrary : libhello-jni.soInstall : libhello-jni.so => /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni/libs/armeabiubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b/samples/hello-jni$
2 in apps
a) make file pplication.mk
其中Application.mk 如下:
APP_PROJECT_PATH := /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni
b)
ubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b$ubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b$ make APP=hello-jniAndroid NDK: Building for application 'hello-jni' Gdbserver : [arm-eabi-4.4.0] /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni/libs/armeabi/gdbserverGdbsetup : /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni/libs/armeabi/gdb.setupGdbsetup : + source directory /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni/jniCompile thumb : hello-jni <= /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni/jni/hello-jni.cSharedLibrary : libhello-jni.soInstall : libhello-jni.so => /home/ubuntu/android/ToolsForLinux/android-ndk-r4b/apps/hello-jni/libs/armeabiubuntu@ubuntu-desktop:~/android/ToolsForLinux/android-ndk-r4b$
更多相关文章
- 如何在Android(安卓)NDK中调用第三方库文件(.so)
- Android代码实现WiFi连接
- 【Android】Tips for Android(安卓)developer: “Conversion to
- android 清空之前task中的activity
- Android(安卓)Studio将本地计算机文件上传到模拟器scard文件中
- Android(安卓)常见错误处理
- [Android(安卓)Training视频系列] 6.2 Saving Files(保存文件)
- android开玩笑之创建xml文件
- 自定义radio,尊重原创,声明此文章为转载