Questions tagged [gradlew]

gradlew is an executable file created by the gradle wrapper plugin, to replace the normal gradle executable for a project

While the normal Gradle executable comes with the installed version and therefor depends on that version, gradlew downloads the correct version of Gradle (specified in the Gradle build script) and thereby ensures that the build is independent of the installed Gradle version.

One obtains a gradlew executable by applying the Gradle wrapper plugin in the build script, specifying a Gradle version and executing

gradle wrapper

After that gradlew can be used whenever one normally would use Gradle.

Official Gradle website: https://gradle.org/

1210 questions
17
votes
11 answers

Task 'assembleRelease' not found in root project 'android'

I'm using Reactnative 0.54.0 and react-native-cli 2.0.1 along side gradle 4.8.1 I have created a react-native project using create-react-native-app myProjectName When I created the project, it doesn't include android and ios folders, so I added them…
Nasser Hadjloo
  • 12,312
  • 15
  • 69
  • 100
17
votes
13 answers

'gradlew' is not recognized as an internal or external command error in Android Studio terminal

Getting error - 'gradlew' is not recognized as an internal or external command. operable program or batch file. inside Android Studio terminal. Can anyone please tell why it's not recognizing gradlew
Shirish Herwade
  • 11,461
  • 20
  • 72
  • 111
17
votes
3 answers

Call one Gradle Task from another with arguments

I have a gradle task which calls a script and passed the command line arguments to the script using -PARGS. task taskAll(type: Exec, dependsOn: taskinit) { environment['PROJECT_ROOT'] = "${projectDir}" workingDir…
Prasoon
  • 425
  • 1
  • 6
  • 18
17
votes
6 answers

How to retrieve path to ADB in build.gradle

I trying to start application via gradle task. task runDebug(dependsOn: ['installDebug', 'run']) { } task run(type: Exec) { commandLine 'adb', 'shell', 'am', 'start', '-n', 'com.example.myexample/.ui.SplashScreenActivity' } But this code don't…
Dima
  • 1,490
  • 16
  • 25
15
votes
1 answer

Why is there a difference between ./gradlew clean build and ./gradlew clean :build

I have the following situation: I have a project with several subprojects. Today I tried to build the projects with gradle via command line. The build was successful when I executed ./gradlew clean :build, but not with ./gradlew clean build. It…
Thomas Böhm
  • 1,456
  • 1
  • 15
  • 27
15
votes
1 answer

Can "testBuildType" be conditional in build.gradle file of Android project?

I have 2 build types of my application: debug and release. I want to execute tests on both build types. But currently only one Build Type is tested. By default it is the debug Build Type, but this can be reconfigured with: android { ... …
Khushbu Shah
  • 1,603
  • 3
  • 27
  • 45
15
votes
1 answer

What does "Sync Project with Gradle File " really mean?

In Android Studio there is a button Sync Project with Gradle File, I always use it, and it's useful. It will download dependence packages and maybe something more. But what does it really mean? Is there a corresponding command in gradlew? If I…
Kassadin
  • 449
  • 4
  • 15
15
votes
1 answer

Unable to run gradlew

I've setup a build.gradle file with apply plugin: 'java'. I tried setting up a gradle wrapper using the instructions here, but when I type sudo ./gradlew build, I get an error sudo: ./gradlew: command not found. When I type gradle build, the project…
Nav
  • 19,885
  • 27
  • 92
  • 135
14
votes
4 answers

GitLab CI secret variables for Gradle publish

How to setup Gradle publish task user credentials with GitLab CI secret variables? I am using gradle maven publish plugin, and here is snippet from build.gradle repositories { maven { credentials { username artifactUser …
Ruwanka De Silva
  • 3,555
  • 6
  • 35
  • 51
14
votes
3 answers

Execute gradle build task from any location

I´m trying to build my gradle projects from other locations than the project folder itself, but it always says it couldn´t find build task. What I´ve tried so far: sudo ./myprojects/myapp/gradlew build sudo ./myprojects/myapp/gradlew…
Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136
12
votes
1 answer

Gradle : gradlew expecting in

i am facing this issue sparsh610@DESKTOP-551C51M:/mnt/e/xxxxxxxxx$ ./gradlew mm : not found2: ./gradlew: : not found8: ./gradlew: ./gradlew: 52: ./gradlew: Syntax error: word unexpected (expecting "in") i verified that my system has gradle…
sparsh610
  • 1,552
  • 3
  • 27
  • 66
12
votes
2 answers

Why did gradlew :app:dependencyInsight fail?

I try to run this command to list all the dependencies of firebase-messaging library : gradlew :app:dependencyInsight --configuration compile --dependency firebase-messaging but it's return me : :app:dependencyInsight No dependencies matching…
zeus
  • 12,173
  • 9
  • 63
  • 184
12
votes
6 answers

How to reduce my java/gradle docker image size?

I have a Docker file like the following: FROM openjdk:8 ADD . /usr/share/app-name-tmp WORKDIR /usr/share/app-name-tmp RUN ./gradlew build \ mv ./build/libs/app-name*.jar /usr/share/app-name/app-name.jar WORKDIR /usr/share/app-name RUN rm…
iamdeit
  • 5,485
  • 4
  • 26
  • 40
12
votes
2 answers

IntelliJ IDEA takes a long time when refreshing a Gradle project

I have a very large project, with many sub-projects configured in Gradle. When I do a clean build from the command line, it takes about 10 minutes, but after that, building the whole project is very fast. My problem is when importing the project…
Farzad
  • 1,770
  • 4
  • 26
  • 48
12
votes
3 answers

Getting error "Gradle version 1.10 is required. Current version is 1.12." when executing "gradle wrapper"?

I'm trying to execute gradle wrapper for an Android project, and this error is raised: A problem occurred evaluating root project 'myapp'. > Gradle version 1.10 is required. Current version is 1.12. If using the gradle wrapper, try editing the…
XåpplI'-I0llwlg'I -
  • 21,649
  • 28
  • 102
  • 151