Search code examples
androidandroid-gradle-pluginbuild.gradlegradlew

Setting project properites in gradle task for a project


Adding the following line to gradle.properties project.setProperty("android.testInstrumentationRunnerArguments.class","testing")

will throw an error that Could not set unknown property 'android.testInstrumentationRunnerArguments.class' for project ':app' of type org.gradle.api.Project.

But running the command ./gradlew connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=testing will add this to project properties that i can verify from project.getProperties() method.Can some why explain how to resolve the error.


Solution

  • It turns out that i have to delcare the property name in the gradle.properties file under project directory to resolve the issue