android studio之NDK配置
2016-07-11 本文已影响57人
小相柳
最近在做android的卸载监听时需要用到NDK,下载了NDK,并且各种设置都弄了之后依然报错。查了许久之后终于解决,特记录之:
1:项目根目录的build.gradle下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.2'
}
}
allprojects {
repositories {
jcenter()
}
}
2:App下build.gradle:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.lzyblog.uninstalldemo"
minSdkVersion.apiLevel 14
targetSdkVersion.apiLevel 23
}
ndk {
moduleName "uninstalled_observer"
ldLibs.addAll(['log', 'android', 'EGL', 'GLESv1_CM'])
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
}
}
}
}
其他Module下也要同样改为applyplugin:'com.android.model.library'
之后再编译就OK了