Search code examples
androidandroid-studiogradlegradlew

Modifying run configurations from gradle CLI


I am writing an Android Application (app) which has dependency on a library (lib). I want to run the unit test cases present in this library.

Running the test cases as it is, gave me this error

java.lang.RuntimeException: java.lang.RuntimeException: build\intermediates\manifests\full\debug\AndroidManifest.xml not found or not a file; it should point to your project's AndroidManifest.xml

Changing the working directory path in the run/debug configurations from 'lib' to 'app' helped me resolve this issue.

However, when I run the same test cases using Gradle CLI, the test cases fail with the same error as above.

Can someone tell me how/where to set the working directory while using gradle/gradlew please?


Solution

  • The working directory is your working directory is your working directory.

    Just cd into app before you call gradle / gradlew and your working directory is app.

    You can of course also set the workingDir property of the task of type Test that runs to make it independent of the dir where you are executing Gradle which probably is the better variant.