Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the gradle command executed when Android Studio runs a build configuration?

Backstory:

  • Module A depends on Module B
  • Want to know the gradle command line execution when Android Studio runs the unit test package for Module A

This is important because I'm trying to compare how it differs from executing tests from command line with: ./gradlew :testDebug

You see, when running the test package from Android Studio my tests run correctly, but running with command line above gradle throws an exception.

The root of the problem is that when run on command line gradle cannot find resource file for dependent Module B. Line that throws exception: setParametersFromResource(context, R.raw.coursera_mobile_android, VALUE_NAMESPACE);

like image 642
Brice Pollock Avatar asked Feb 15 '16 19:02

Brice Pollock


People also ask

Where can I find gradle in Android Studio?

gradle file, located in the root project directory, defines dependencies that apply to all modules in your project. By default, the top-level build file uses the plugins block to define the Gradle dependencies that are common to all modules in the project.

How do I open app build gradle?

Open cmd in the project directory and execute gradlew. bat assemble . Actually i had a project already just want to import it for that proceed with by the following File-->Open-->build. gradle(from that existing project).

How do I sync gradle with Android studio?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

How do I get value from build gradle?

If you're creating the original value using resValue then you don't have to read it back from resources. You already have the value in your build. gradle script. Just assign it to a local variable and use it to create a resource for each variant.


1 Answers

I knew before you can read the gradle executions via the Gradle Console, but didn't realize you can execute that bundle of commands via command line.

Example from Gradle console:

Execute [:<module_name>:assembleDebug, :<module_name>:assembleDebugUnitTest]

to:

./gradlew [:<module_name>:assembleDebug, :<module_name>:assembleDebugUnitTest]
like image 178
Brice Pollock Avatar answered Sep 30 '22 20:09

Brice Pollock