how to add test dependency with android gradle plugin experimental 0.1.0 -


i followed this guide build ndk hybrid project on android studio 1.3.0 rc1 gradle-experimental:0.1.0.

everything ok, if try add test library dependency, found method androidtestcompile not supported more. this:

error: dsl method not found

and testcompile cause same error.

the offical guide doesn't talk this. so, how can add add test dependency gradle-experimental or version not supports function?

this build.gradle(project):

// top-level build file can add configuration options common sub-projects/modules.  buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle-experimental:0.1.0'     } }  allprojects {     repositories {         jcenter()     } } 

this 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 dependency use junit 4 rules     androidtestcompile 'com.android.support.test:rules:0.3'     // set dependency build , 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'  } 

you need ensure using gradle 2.5. under file > project structure, navigate project , set "gradle version" 2.5. under file > settings, navigate build, execution, deployment > build tools > gradle , make sure "use default gradle wrapper (recommended)" checked. edit gradle wrapper editing project's gradle/wrapper/gradle-wrapper.properties file. mine looks this:

#mon jul 13 17:55:42 edt 2015 distributionbase=gradle_user_home distributionpath=wrapper/dists zipstorebase=gradle_user_home zipstorepath=wrapper/dists distributionurl=https\://services.gradle.org/distributions/gradle-2.5-all.zip 

i did these steps in above order, after thinking when writing this, perhaps best reverse order. found needed exit android studio , restart before changes recognized. perhaps cached somewhere, or perhaps artifact of order in did things.

also, see this thread little more info setting gradle version.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -