zoukankan      html  css  js  c++  java
  • 使用Android Studio自带的NDK编译JNI

    /**********************************************************************************
     *                      使用Android Studio自带的NDK编译JNI
     * 说明:
     *     省得自己另外去下载NDK,编译JNI,麻烦。
     *              
     *                                          2017-4-30 深圳 龙华民治樟坑村 曾剑锋
     *********************************************************************************/
    
    一、参考文档:
        1. NDK环境搭建-windows篇
            http://www.jianshu.com/p/708e6bf68ae9
        2. Mistake in documentation/error message?
            https://github.com/android-ndk/ndk/issues/264
        3. 编译一个模块时出现undefined reference to `__android_log_print' 
            http://bbs.csdn.net/topics/360020076
    4. Android Studio 之 JNI 开发详解
    http://www.jianshu.com/p/bc2b46381d88
    5. 向您的项目添加 C 和 C++ 代码
    https://developer.android.com/studio/projects/add-native-code.html?hl=zh-cn
    二、error: 1. 错误1: 1. 错误现象: D:zengjfSourceCodeAndroidandroid_appTest>ndk-build C:/Users/zengjf/AppData/Local/Android/Sdk/ndk-bundle/build//../build/core/build-binary.mk:687: Android NDK: Module zengjf depends on undefined modules: android_runtime nativehelper cutils utils log C:/Users/zengjf/AppData/Local/Android/Sdk/ndk-bundle/build//../build/core/build-binary.mk:701: *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies) . Stop. D:zengjfSourceCodeAndroidandroid_appTest> 2. 解决方法 1. C:UserszengjfAppDataLocalAndroidSdk dk-bundleuildcoreuild-binary.mk 2. 修改内容: ... ifdef undefined_libs $(call __ndk_warning,Module $(LOCAL_MODULE) depends on undefined modules: $(undefined_libs)) # https://github.com/android-ndk/ndk/issues/208 # ndk-build didn't used to fail the build for a missing dependency. This # seems to have always been the behavior, so there's a good chance that # there are builds out there that depend on this behavior (as of right now, # anything using libc++ on ARM has this problem because of libunwind). # # By default we will abort in this situation because this is so completely # broken. A user may define APP_ALLOW_MISSING_DEPS to "true" in their # Application.mk or on the command line to revert to the old, broken # behavior. APP_ALLOW_MISSING_DEPS=true // add this line ifneq ($(APP_ALLOW_MISSING_DEPS),true) $(call __ndk_error,Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies)) endif endif ... 2. 错误2: 1. 错误现象: undefined references to `__android_log_print' follow 2. 解决方法: Android.mk文件中加入LOCAL_LDLIBS += -llog即可
  • 相关阅读:
    IE11开发人员工具 js脚本debugger调试
    Dynamics CRM OData方式进行增删改查时报错的问题
    Get Form type using javascript in CRM 2011
    Dynamics CRM 同一实体多个Form显示不同的Ribbon按钮
    Dynamics CRM 通过OData查询数据URI中包含中文的情况
    打印控件
    spark
    zookeeper集群配置与启动——实战
    javascript学习
    etcd
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/6789317.html
Copyright © 2011-2022 走看看