Android 系统内置App JNI

说明

将Android应用作为系统内置遇到一些问题:

  1. 一个是使用Android源码的mmm命令生成的JNI名字和使用NDK生成的JNI的名字是不一样的;
  2. 另外就是AndroidManifest.xml中的targetSDKVersion不能低于运行版本。

JNI

Android mmm命令
......
No private recovery resources for TARGET_DEVICE sabresd_6dq
make: Entering directory `/home/myzr/myandroid'
Import includes file: out/target/product/sabresd_6dq/obj/SHARED_LIBRARIES/shutdown_intermediates/import_includes
target thumb C: shutdown <= /home/myzr/myandroid/packages/apps/Shutdown/jni/shutdown.c
target SharedLib: shutdown (out/target/product/sabresd_6dq/obj/SHARED_LIBRARIES/shutdown_intermediates/LINKED/shutdown.so)
target Symbolic: shutdown (out/target/product/sabresd_6dq/symbols/system/lib/shutdown.so)
Export includes file: /home/myzr/myandroid/packages/apps/Shutdown/jni/Android.mk -- out/target/product/sabresd_6dq/obj/SHARED_LIBRARIES/shutdown_intermediates/export_includes
target Strip: shutdown (out/target/product/sabresd_6dq/obj/lib/shutdown.so)
Install: out/target/product/sabresd_6dq/system/lib/shutdown.so
make: Leaving directory `/home/myzr/myandroid'
NDK 生成 JNI
$ $NDK/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
[armeabi] Compile thumb : shutdown <= shutdown.c
[armeabi] SharedLibrary : libshutdown.so
[armeabi] Install : libshutdown.so => libs/armeabi/libshutdown.so
shell命令修改文件名
root@android:/ # mv /system/lib/shutdown.so /system/lib/libshutdown.so

targetSDKVersion

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
上一篇:Centos7部署分布式文件存储(Fastdfs)


下一篇:小记--------hive sql函数及hive 命令行简单操作-2