apply plugin: 'com.android.model.application'
model {
...
android.ndk {
moduleName = "hello-jni"
}
...
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
그리고 디버깅을 해볼 것이기 때문에 네이티브와 앱 모듈을 디버깅이 가능하도록 설정한다.
apply plugin: 'com.android.model.application'
model {
...
android.buildTypes {
release {
isMinifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
debug {
isJniDebuggable = true
isDebuggable = true
}
}
...
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
이렇게 하면 디버깅이 가능한 NDK 빌드 구성은 끝난다. 아래는 전체 build.gradle
파일 내용이다.
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "kr.pe.burt.hellojni"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
}
android.ndk {
moduleName = "hello-jni"
}
android.buildTypes {
release {
isMinifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
debug {
isJniDebuggable = true
isDebuggable = true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}