Ответ 1
Хотя, опоздал для пользователя, который задал этот вопрос, тем не менее он может помочь другим.
Следующий образец кода работает отлично для меня. Я тестировал его со следующими настройками: Gradle -experimental-0.4.0, Gradle wrapper - 2.8, версия для Android версии 2.0 2.0.
apply plugin: 'com.android.model.application'
model {
def signConf // <-- Note the changes made here
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.0"
defaultConfig.with {
applicationId = "in.atultiwari.helloandroidjni"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
signingConfig = signConf // <-- Note the changes made here
}
}
android.signingConfigs { // <-- Note the changes made here
create("signRelease") { // <-- Note the changes made here
keyAlias = 'myKeyAlias'
keyPassword = 'myKeyPassword'
storeFile = file('myKestoreFile.jks')
storePassword = 'myKeystorePassword'
signConf = it
}
}
android.ndk {
moduleName = "hello-android-jni"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
P.S. - он не работает с minifyEnabled = true
, и в этом случае возникает ошибка, связанная с transformClassesAndResourcesWithProguardForRelease
.
Изменить - 1. minifyEnabled = true
работает с вышеуказанными настройками. Оказывается, у меня был файл правил proguard-rules, и как-то он вызывал указанную ошибку.