ndk系列——使用新版Android Studio创建ndk项目
来源:互联网 发布:淘宝体检中心是什么 编辑:程序博客网 时间:2024/04/29 21:01
环境:android studio 2.2beta2
此版本的studio已经完全支持ndk项目,好用的把你感动哭~
1我们来新建个ndk项目
自动创建空的activity会自动生成ndk例子
生成的c++文件代码
注意下面的 include c++ Support勾选后项目会生成相应的cpp包 相比于之前的android studio目录看看有什么不同
可以看到app下面多了个包cpp
多了个External Build Files 和里面的文件。
阅读内容可知通过这个文件我们可以将c文件自动构建为相应的库通过gradle共享给app
# Sets the minimum version of CMake required to build the native# library. You should either keep the default value or only pass a# value of 3.4.0 or lower.cmake_minimum_required(VERSION 3.4.1)# Creates and names a library, sets it as either STATIC# or SHARED, and provides the relative paths to its source code.# You can define multiple libraries, and CMake builds it for you.# Gradle automatically packages shared libraries with your APK.add_library( # Sets the name of the library. native-lib # Sets the library as a shared library. SHARED # Provides a relative path to your source file(s). # Associated headers in the same location as their source # file are automatically included. src/main/cpp/native-lib.cpp )# Searches for a specified prebuilt library and stores the path as a# variable. Because system libraries are included in the search path by# default, you only need to specify the name of the public NDK library# you want to add. CMake verifies that the library exists before# completing its build.find_library( # Sets the name of the path variable. log-lib # Specifies the name of the NDK library that # you want CMake to locate. log )# Specifies libraries CMake should link to your target library. You# can link multiple libraries, such as libraries you define in the# build script, prebuilt third-party libraries, or system libraries.target_link_libraries( # Specifies the target library. native-lib # Links the target library to the log library # included in the NDK. $\{log-lib} )
0 0
- ndk系列——使用新版Android Studio创建ndk项目
- ndk系列——使用Android Studio 初探NDK开发
- NDK-Android项目创建
- android studio 使用NDK
- Android Studio NDK使用
- Android Studio 使用NDK
- android studio使用ndk
- Android 开发学习:新版NDK 使用
- android NDK——搭建Android Studio的NDK环境
- android NDK——搭建Android Studio的NDK环境
- android NDK——搭建Android Studio的NDK环境
- android NDK——搭建Android Studio的NDK环境
- Android Studio NDK开发之javah命令使用—转载
- Android Studio ndk第一次使用
- Android Studio 下使用NDK
- Android Studio 使用NDK编程
- Android Studio中使用NDK
- Android Studio 下使用NDK
- java ArrayList 的实现原理
- 浅谈在Android中存在的一些内存泄漏
- 一个例子
- 2,BMP文件格式解析
- weak 和 unowned
- ndk系列——使用新版Android Studio创建ndk项目
- 那些签名的牛逼之言
- MCU8051IDE学习1
- 学习Android
- oracle存储过程语法与结构
- java程序操作命令行
- H.264 Profile、Level、Encoder三张简图
- pvp 游戏如何解决玩家匹配等待时间过长的问题
- 安装mysql时提示下列软件包有未满足的依赖关系