Android NDK总结

2017-11-17  本文已影响21人  Jcccccccccc

NDK优点

变化

从Android Studio 2.2开始,使用CMake作为构建原生库的工具,代替原来的ndk-build

CMake的配置

android官网指南

android {
  ...
  defaultConfig {...}
  buildTypes {...}

  // Encapsulates your external native build configurations.
  externalNativeBuild {

    // Encapsulates your CMake build configurations.
    cmake {

      // Provides a relative path to your CMake build script.
      path "CMakeLists.txt"
    }
  }
}
android {
  ...
  defaultConfig {
    ...
    externalNativeBuild {
      cmake {...}
      // or ndkBuild {...}
    }

    ndk {
      // Specifies the ABI configurations of your native
      // libraries Gradle should build and package with your APK.
      abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a',
                   'arm64-v8a'
    }
  }
  buildTypes {...}
  externalNativeBuild {...}
}

调试C/C++代码 LLDB

官网说明

上一篇 下一篇

猜你喜欢

热点阅读