apply plugin: 'com.android.application'
android {
// android 版本管理
compileSdkVersion 26 编译版本号
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "redmoney.testjni"
minSdkVersion 19 最低运行版本
targetSdkVersion 26 目标兼容最高版本
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
// 开关 混淆 压缩
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// jni 编译 cmake文件
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
//指定 NDK 相关信息
defaultConfig {
//添加
ndk {
moduleName "demo" //库名字
//ldLibs "log", "z", "m" 指定Ndk so 编译的架构
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}
//添加 指定各种路径
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
// 包含 jar 或者liblly
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}