解决方案 »

  1.   

    你引用的第三方的 动态库 是经过NDK交叉编译的吗,  这里需要注意 必须是 NDK 工具交叉编译, 不能是 其它的交叉编译工具, 我之前用 arm 开发板 的交叉编译工具编译好了, 放到 android 上不能用, 要用 ndk 生成的交叉编译工具编译;另外 发一下 你的 Android.mk 文件, 我看看, 是不是 makefile 写错了
      

  2.   

    感谢楼上的回复 , 我用的是Eclipse CDT 编译的还有,   我根本就没写.mk文件 ,  但项目里确实是有一个, 估计是他自生成的:
    LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE    := jsj
    LOCAL_SRC_FILES := jsj.cppinclude $(BUILD_SHARED_LIBRARY)
      

  3.   

    帮忙看看啊。。你的 Android.mk 中没有引入 外部的第三方 .so 动态库文件, 所以编译完以后肯定没有第三方的 动态库;第三方动态库 使用之前需要预编译 :  预编译之后 可以使用预编译好的库, 下面就是 将 libstatic.a 库预编译成 ndk的 static 库
    LOCAL_PATH := $(call my-dir)    
    include $(CLEAR_VARS)   
    LOCAL_MODULE    := static  
    LOCAL_SRC_FILES := libstatic.a   
    include $(PREBUILT_STATIC_LIBRARY) 你试着用 ndk 中的编译工具 ndk-build 编译, 没用过 eclipse 环境编译过 ndk 文件, 下面的博客里面有详细的 ndk 编译过程 还有 Android.mk 如何编写给你推荐个 NDK 相关的博客 : http://blog.csdn.net/shulianghan/article/details/18964835
      

  4.   

    这和编译脚本、第三方库什么的没关系。每次执行 ndk-build 完
    libs\armeabi 目录下面,自己拷贝进去的 so 都会被删除。
    再考一次吧,希望你有备份……
      

  5.   

    帮忙看看啊。。你的 Android.mk 中没有引入 外部的第三方 .so 动态库文件, 所以编译完以后肯定没有第三方的 动态库;第三方动态库 使用之前需要预编译 :  预编译之后 可以使用预编译好的库, 下面就是 将 libstatic.a 库预编译成 ndk的 static 库
    LOCAL_PATH := $(call my-dir)    
    include $(CLEAR_VARS)   
    LOCAL_MODULE    := static  
    LOCAL_SRC_FILES := libstatic.a   
    include $(PREBUILT_STATIC_LIBRARY) 你试着用 ndk 中的编译工具 ndk-build 编译, 没用过 eclipse 环境编译过 ndk 文件, 下面的博客里面有详细的 ndk 编译过程 还有 Android.mk 如何编写给你推荐个 NDK 相关的博客 : http://blog.csdn.net/shulianghan/article/details/18964835
    第三方的动态庘就是.so 文件 , 已经编译好的, 我直接用就可以, 但我不知道在.mk文件中如何引用这种在armeabi中的.so 文件
      

  6.   

    帮忙看看啊。。你的 Android.mk 中没有引入 外部的第三方 .so 动态库文件, 所以编译完以后肯定没有第三方的 动态库;第三方动态库 使用之前需要预编译 :  预编译之后 可以使用预编译好的库, 下面就是 将 libstatic.a 库预编译成 ndk的 static 库
    LOCAL_PATH := $(call my-dir)    
    include $(CLEAR_VARS)   
    LOCAL_MODULE    := static  
    LOCAL_SRC_FILES := libstatic.a   
    include $(PREBUILT_STATIC_LIBRARY) 你试着用 ndk 中的编译工具 ndk-build 编译, 没用过 eclipse 环境编译过 ndk 文件, 下面的博客里面有详细的 ndk 编译过程 还有 Android.mk 如何编写给你推荐个 NDK 相关的博客 : http://blog.csdn.net/shulianghan/article/details/18964835
    第三方的动态庘就是.so 文件 , 已经编译好的, 我直接用就可以, 但我不知道在.mk文件中如何引用这种在armeabi中的.so 文件
    上面已经说的很清楚了 即使是你 交叉编译好的 库 也要预编译一下,  预编译 是把第三方库引入到 jni 库中, 不是要真的进行编译  上面的 代码 就是 预编译的代码
      

  7.   

    你看下 ndk 目录下 的 docs 目录里的文档 PREBUILTS.html 文档全文 
    NDK Prebuilt library support:Android NDK r5 introduced support for prebuilt libraries (shared and static), i.e. the ability to include and use, in your applications, prebuilt version of libraries.This feature can be useful for two things:You want to distribute your own libraries to third-party NDK developers without distributing your sources.You want to use a prebuilt version of your own libraries to speed up your build.This document explains how this support works.I. Declaring a prebuilt library module:Each prebuilt library must be declared as a single independent module to the build system. Here is a trivial example where we assume that the file "libfoo.so" is located in the same directory than the Android.mk below:    LOCAL_PATH := $(call my-dir)    include $(CLEAR_VARS)
        LOCAL_MODULE := foo-prebuilt
        LOCAL_SRC_FILES := libfoo.so
        include $(PREBUILT_SHARED_LIBRARY)
    Notice that, to declare such a module, you really only need the following:Give the module a name (here 'foo-prebuilt'). This does not need to correspond to the name of the prebuilt library itself.Assign to LOCAL_SRC_FILES the path to the prebuilt library you are providing. As usual, the path is relative to your LOCAL_PATH.IMPORTANT: You must ensure that the prebuilt library corresponds to the target ABI you are using. More on this later.Include PREBUILT_SHARED_LIBRARY, instead of BUILD_SHARED_LIBRARY, if you are providing a shared, library. For static ones, use PREBUILT_STATIC_LIBRARY.
    A prebuilt module does not build anything. However, a copy of your prebuilt shared library will be copied into $PROJECT/obj/local, and another will be copied and stripped into $PROJECT/libs/<abi>.II. Referencing the prebuilt library in other modules:Simply list your prebuilt module's name in the LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES declaration in the Android.mk of any module that depends on them.For example, a naive example of a module using libfoo.so would be:    include $(CLEAR_VARS)
        LOCAL_MODULE := foo-user
        LOCAL_SRC_FILES := foo-user.c
        LOCAL_SHARED_LIBRARIES := foo-prebuilt
        include $(BUILD_SHARED_LIBRARY)
    III. Exporting headers for prebuilt libraries:The example above was called 'naive' because, in practice, the code in foo-user.c is going to depend on specific declarations that are normally found in a header file distributed with the prebuilt library (e.g. "foo.h").In other words, foo-user.c is going to have a line like:  #include <foo.h>
    And you need to provide the header and its include path to the compiler when building the foo-user module.A simple way to deal with that is to use exports in the prebuilt module definition. For example, assuming that a file "foo.h" is located under the 'include' directory relative to the prebuilt module, we can write:    include $(CLEAR_VARS)
        LOCAL_MODULE := foo-prebuilt
        LOCAL_SRC_FILES := libfoo.so
        LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
        include $(PREBUILT_SHARED_LIBRARY)
    The LOCAL_EXPORT_C_INCLUDES definition here ensures that any module that depends on the prebuilt one will have its LOCAL_C_INCLUDES automatically prepended with the path to the prebuilt's include directory, and will thus be able to find headers inside that.IV. Debugging prebuilt binaries:We recommend you to provide prebuilt shared libraries that contain debug symbols. The version that is installed into $PROJECT/libs/<abi>/ is always stripped by the NDK build system, but the debug version will be used for debugging purposes with ndk-gdb.V. ABI Selection of prebuilt binaries:As said previously, it is crucial to provide a prebuilt shared library that is compatible with the targeted ABI during the build. To do that, check for the value of TARGET_ARCH_ABI, its value will be:  armeabi     => when targeting ARMv5TE or higher CPUs
      armeabi-v7a => when targeting ARMv7 or higher CPUs
      x86         => when targeting x86 CPUs
      mips        => when targeting MIPS CPUs
    Note that armeabi-v7a systems can run armeabi binaries just fine.Here's an example where we provide two versions of a prebuilt library and select which one to copy based on the target ABI:    include $(CLEAR_VARS)
        LOCAL_MODULE := foo-prebuilt
        LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfoo.so
        LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
        include $(PREBUILT_SHARED_LIBRARY)
    Here. we assume that the prebuilt libraries to copy are under the following directory hierarchy:    Android.mk            --> the file above
        armeabi/libfoo.so     --> the armeabi prebuilt shared library
        armeabi-v7a/libfoo.so --> the armeabi-v7a prebuilt shared library
        include/foo.h         --> the exported header file
    NOTE: Remember that you don't need to provide an armeabi-v7a prebuilt library, since an armeabi one can easily run on the corresponding devices.
      

  8.   

    第三方库 使用之前 需要声明一下 在 Android,mk 里面
      

  9.   

    感谢细心的教导 , 看了半天 还是不明白 , 请看我的截图:整个项目中只有jni目录下有Android.mk 文件 , 内容上面有发出来,在这个项目添加NDK支持前,armeabi里面是有好些个.so文件的,是项目使用第三方功能(百度地图等)官方说明拷时去的, 但当我添加NDK支持后, 只要一编译,那些个.so文件就消失,我自己的却留在那,感觉应该就是android.mk 文件没处理好,但是我应该怎么写呢?   对于这种成熟的第三方库的引用, 我还需要做编译吗? 需要自己写静态文件吗?   谢谢!
      

  10.   

    对于百度的 so 文件 , 你先把 jni 那些编译好以后 在拷贝百度的就行了, 直接覆盖拷贝 ; 
      

  11.   

    感谢细心的教导 , 看了半天 还是不明白 , 请看我的截图:整个项目中只有jni目录下有Android.mk 文件 , 内容上面有发出来,在这个项目添加NDK支持前,armeabi里面是有好些个.so文件的,是项目使用第三方功能(百度地图等)官方说明拷时去的, 但当我添加NDK支持后, 只要一编译,那些个.so文件就消失,我自己的却留在那,感觉应该就是android.mk 文件没处理好,但是我应该怎么写呢?   对于这种成熟的第三方库的引用, 我还需要做编译吗? 需要自己写静态文件吗?   谢谢!我也没遇到过这种情况 ,  只要一编译 就会清空 与 android.mk 无关的 库文件,  先把ndk 编译好了 在拷贝 其它第三方的动态库