Ho seguito la guida this per creare un progetto ibrido ndk su Android Studio 1.3.0 RC1 con gradle-experimental: 0.1.0.come aggiungere la dipendenza di test con Android gradle plugin sperimentale 0.1.0
Tutto è OK, ma se provo ad aggiungere la dipendenza della libreria di test, ho trovato che il metodo androidTestCompile
non è più supportato. Come questo:
E testCompile
causa anche lo stesso errore.
La guida ufficiale non parla di questo. Quindi, come posso aggiungere add dipendenze test gradle-experimental Oppure questa versione non supporta questa funzione?
Questo è il mio build.gradle (progetto):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Questo è build.gradle (moudle):
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "23.0.0 rc3"
defaultConfig.with {
applicationId = "co.yishun.onemoment.app"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 5
versionName = "2.0 canary"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
}
android.buildTypes {
release {
isMinifyEnabled = true
proguardFiles += file('proguard-rules.pro')
}
}
android.productFlavors {
create("flavor1") {
applicationId = 'com.app'
}
}
android.ndk {
moduleName = "c_test"
}
}
dependencies {
androidTestCompile 'com.android.support.test:runner:0.3'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.3'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
}