C++学习(四四零)android studio如何关联cmake
Posted hankern
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++学习(四四零)android studio如何关联cmake相关的知识,希望对你有一定的参考价值。
1、安装cmake,会安装在android sdk目录下
Tools > Android > SDK Manager 点击 SDK Tools 标签 选中CMake 框
也可以把下载好的cmake放到该目录下。
2、在local.properties中设置cmake路径
ndk.dir=D\\:\\\\android-ndk-r19c
sdk.dir=D\\:\\\\android-sdk-windows
#cmake.dir=D\\:\\\\android-sdk-windows\\\\cmake\\\\3.12.0\\\\bin
cmake.dir=D\\:\\\\android-sdk-windows\\\\cmake\\\\3.12.0
3、在android studio工程中设置选用的cmake
修改module的build.gradle,设置cmake版本
apply plugin: 'com.android.application'
android
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig
applicationId "com.example.testnativecplusplus"
minSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild
cmake
cppFlags ""
abiFilters "arm64-v8a"
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
externalNativeBuild
cmake
path "src/main/cpp/CMakeLists.txt"
//version "3.10.2"
version "3.12.0"
dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
/*
dexOptions
//使用增量模式构建
incremental true
//最大堆内存
javaMaxHeapSize "8g"
//是否支持大工程模式
jumboMode = true
//预编译
preDexLibraries = true
//线程数
threadCount = 8
*/
以上是关于C++学习(四四零)android studio如何关联cmake的主要内容,如果未能解决你的问题,请参考以下文章
C++学习(四四三)Android手机支持的opengl特性
C++学习(四零四)hidden symbol `atexit‘ in XXX is referenced by DSO