Android NDK开发(二)

在cpp文件夹下新建一个c/c++文件

 

 

java层的代码

 

 

给CMakeLists.txt配置加下面的代码
add_library( # Sets the name of the library.
             demo

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
             src/main/cpp/demo.c)

target_link_libraries( # Specifies the target library.
            demo

            # Links the target library to the log library
            # included in the NDK.
            ${log-lib} )
build.gradle里面一定要有这两个配置

 

c中的代码

 

 

 

 

运行测试

 

 

posted @ 2020-04-15 22:00  乔瑞  阅读(152)  评论(0编辑  收藏  举报

载入天数...载入时分秒...