[INSTALL_FAILED_MISSING_SHARED_…

来源:互联网 发布:淘宝怎样重新申请退款 编辑:程序博客网 时间:2024/06/07 17:27
刚开始学习Android,想了解一下如何在Android下开发C的组件。在网上搜了半天都没有找到很系统的介绍文章。最后发现,其实关于共享库和JNI最好的例子就在Android的源代码里面。
<androidsources>/development/samples/PlatformLibrary下包含了关于如何编写和使用共享库的完整例子,其中README.txt给出了简明的介绍。
在编译了全部代码后,接下来尝试在模拟器中安装并运行PlatformLibraryClient.apk
1. 运行模拟器(Android SDK 1.5r2)
$ emulator -avd target2 -system <androidsources>/out/target/product/generic/system.img
2. 显示应该安装哪些文件
$ cd <android sources>
$ source build/envsetup.sh
$ cd development/samples/PlatformLibrary/
$ mm
显示结果:
Install:out/target/product/generic/system/app/PlatformLibraryClient.apk
Install:out/target/product/generic/system/etc/permissions/com.example.android.platform_library.xml
Install:out/target/product/generic/system/framework/com.example.android.platform_library.jar
Install:out/target/product/generic/system/lib/libplatform_library_jni.so
3. 安装所需文件(不能直接adb installPlatformLibraryClient.apk,否则会出现Failure[INSTALL_FAILED_MISSING_SHARED_LIBRARY])
a) $ cd <android sources>
b) $ adb remount
c) $ adb pushout/target/product/generic/system/etc/permissions/com.example.android.platform_library.xml/system/etc/permissions/
d) $ adb pushout/target/product/generic/system/framework/com.example.android.platform_library.jar/system/framework/
e) $ adb pushout/target/product/generic/system/lib/libplatform_library_jni.so/system/lib/
4. 接下来需要重启模拟器使上面拷贝的文件生效。但注意此时如果直接关闭模拟器再重启,则刚才对systemimage的改变都会丢失。所以应采用以下方法:
$ adb shell stop
$ adb shell start
5. 重启后,安装PlatformLibraryClient.apk
$ adb installout/target/product/generic/system/app/PlatformLibraryClient.apk
6. 安装完毕,"Platform Lib Client"出现在Menu中。点击,运行正常。
0 0