yozhik
yozhik

Reputation: 5064

How to build android project on MacOS from terminal?

I want to build project in Android Studio 3.1.3 on MacOS High Sierra 10.13 from terminal with command:

./gradlew clean build

output: bash:\r: No such file or directory.

or

/gradlew clean build

bash:No such file or directory.

or

gradlew clean build

bash: gradlew command not found.

How can I execute build from command line ? I have looked on stackoverflow answers, but they didn't help me. Thanks.

enter image description here enter image description here

Upvotes: 3

Views: 3185

Answers (2)

Krzysztof Kubicki
Krzysztof Kubicki

Reputation: 676

Your problem is incorrectly cloned and converted project - see here: env: bash\r: No such file or directory

Upvotes: 2

Andre
Andre

Reputation: 364

I suppose you have imported the project from a Windows machine and now it contains some carriage returns '\r'.

try to remove carriage returns by executing following commands in your terminal:

brew install dos2unix # Installs dos2unix Mac
find . -type f -exec dos2unix {} \; # recursively removes windows related stuff

after that you can use gradle wrapper as usual:

./gradlew clean build

Upvotes: 7

Related Questions