Questions tagged [gradle-task]

Gradle has a set of standard tasks provided by common plugins, but also allows defining custom tasks. A gradle task is an atomic unit of work that is scheduled before or other after tasks depending on task ordering constraints.

154 questions
1
vote
1 answer

Run Application configuration stopped working: appears to start executing gradle task [:app:Api.main()] all of a sudden

Yesterday I was able to run a plain Java class in Android Studio without any problems. I did this by creating an Application configuration: ... for running the main() method of some class I defined in the default app module, e.g.: package…
Decent Dabbler
  • 22,532
  • 8
  • 74
  • 106
1
vote
1 answer

Gradle catch error from file in custom task

I'm new to Gradle and I don't know much about it, but in my gradle file I defined the following task: task helloWorld { description "Custom task" ext.srcFile = file("build/reports/checkstyle/main.xml") inputs.file srcFile doLast{ println…
Gamaor
  • 85
  • 3
1
vote
1 answer

Fix custom tasks in gradle. Want to run it manually via at Execution Phase

Why this is not working? I config it first then unzip it at the execution phase where I could run it manually. val nativesOS : Configuration by configurations.creating { this.isTransitive = false …
1
vote
0 answers

android gradle task of type exec execution failure

I have written the following simple task in my android project. task testing (type: Exec) { println workingDir } gradlew testing when I run the above command in the command prompt(Windows), it gives an error: > Task :testing…
Aman Kamani
  • 75
  • 1
  • 10
1
vote
0 answers

Run gradle task only on windows

I have some task: task foo { //Do something } foo.dependsOn(":bar:baz") foo.dependsOn(":bar2:baz2") This task should only run on windows. I know, I could do: import org.apache.tools.ant.taskdefs.condition.Os task foo { if…
JCWasmx86
  • 3,473
  • 2
  • 11
  • 29
1
vote
2 answers

Generated code stays in build folder after Android Studio Build

I am using a gradle task to generate some code for my API and store this code into the build folder. When I am building my application the process deletes the build folder. Is there a way to call my code generation task between the folder deletion…
1
vote
2 answers

Can I call the Gradle properties task on all projects at once in a multi-project build?

I would like to view the properties of a Gradle project, to manually ensure the values look right. When I call the properties task from the root of a multi-project build, it lists the properties of the root project: $ gradle -q…
M. Justin
  • 14,487
  • 7
  • 91
  • 130
1
vote
0 answers

How to read output from a task?

I created a task to compute a version name from the latest git tag. I am basically writing a computed tag into a file in the build directory. However, when I try to read this text from file gives me below…
nuhkoca
  • 1,777
  • 4
  • 20
  • 44
1
vote
2 answers

A problem was found with the configuration of task ':app:compileDebugJavaWithJavac'

A problem was found with the configuration of task ':app:compileDebugJavaWithJavac'. File 'C:\Users\Anoushk\AndroidStudioProjects\crud_app\build\app\intermediates\annotation_processor_list\debug\annotationProcessors.json' specified for property…
Anoushk
  • 551
  • 7
  • 20
1
vote
1 answer

How to execute particular class method with dependency injection through gradle task?

Here is my code in build.gradle task runDataFeeder(type:JavaExec){ classpath = sourceSets.main.runtimeClasspath main = "example.core.RunMigrator" } And my RunMigrator class class Migrator(@Inject val seedDataService: seedDataService) { …
1
vote
1 answer

In gradle kotlin dsl, how to call a dynamic test extension?

I'm trying to add a new configuration option when using the gradle ScalaTest plugin: https://github.com/maiflai/gradle-scalatest In its source code, the config was injected into the Test class as a dynamic extension: static void configure(Test…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

My flutter project failed to run on Android device & it's mentioning some Licenses issue

My flutter SDK path is under C:\flutter. I have the following error when running flutter run: Running Gradle task 'assembleDebug'... Checking the license for package Android SDK Build-Tools 28.0.3 in…
MAKHALED
  • 11
  • 3
1
vote
1 answer

Gradle export environment returned from script

I am trying to write gradle task which do the following: Executes script to obtain some data (let's say there is curl inside) Sets a environment variable with this data. I would like to set this env variable so other gradle tasks can use it for…
AndrewM
  • 69
  • 5
1
vote
0 answers

How is it possible that Gradle task's `outputFiles` differ when run for the first time and when it has run once already?

When I run the below build.gradle.kts script, invoking target downloadAndUnzipFile for the first time, when I run with clean build directory, I get an error. > Task :downloadZipFile Download…
user7610
  • 25,267
  • 15
  • 124
  • 150
1
vote
1 answer

Android Gradle - how to run task after app installation

I need to copy some files to the Android App folder (data/data/...) after installing the app via Gradle. This has to be done at every debug build before the app gets started and thus I assumed I could find a gradle task that could be executed after…
Tobias Reich
  • 4,952
  • 3
  • 47
  • 90