Home » Android » android – how to do a "Gradle sync" with terminal command?

android – how to do a "Gradle sync" with terminal command?

Posted by: admin April 23, 2020 Leave a comment

Questions:

how to run gradle sync by command in linux ?
I dont want “gradle build” cuz i know this would sync and build. I just want a command which does whatever button “sync project with gradle files” does in Android Studio.

How to&Answers:
    ./gradlew --recompile-scripts

Will do a sync without building anything

Answer:

there is no task to trigger sync / config phase directly, but you can call:

./gradlew help

this will trigger config phase and report if it failed or was successful.
This is best practice to detect non-lazy config with the help of scans too.

Answer:

You can explore al the tasks in:

./gradlew tasks

Otherwise if you want to sync and build your app (as root):

./gradlew build