我正在调试Android Studio中的Gradle问题,并看到“运行Gradle同步”的引用,但我不确定如何运行这个命令。
我如何运行“Gradle同步”从Android工作室或Mac终端?
我正在调试Android Studio中的Gradle问题,并看到“运行Gradle同步”的引用,但我不确定如何运行这个命令。
我如何运行“Gradle同步”从Android工作室或Mac终端?
当前回答
快捷方式(Ubuntu, Windows):
Ctrl + F5
将项目与Gradle文件同步。
其他回答
gradle --recompile-scripts
似乎不需要构建任何东西就能进行同步。 您可以通过
gradle --recompile-scripts --continuous
更多信息请参考文档:
https://docs.gradle.org/current/userguide/gradle_command_line.html
任何想要使用命令行与gradle文件同步的项目,请注意:
从Gradle 5.0开始,
——recompile-scripts命令行选项已被移除。
https://docs.gradle.org/5.0/userguide/upgrading_version_4.html#potential_breaking_changes https://docs.gradle.org/current/userguide/command_line_interface.html https://github.com/gradle/gradle/issues/1425
Android studio应该在工具栏中有这个按钮,标记为“同步项目与Gradle文件”
编辑:我不知道什么时候改的,但现在看起来是这样的:
编辑:这是它在3.3.1中的样子 或者从菜单栏选择文件->与Gradle文件同步项目。
Keyboard shortcut lovers can add a shortcut for running gradle sync manually by going to File -> Settings -> Keymap -> Plugins -> Android Support -> Sync Project with gradle files (Right click on it to add keyboard shortcut) -> Apply -> OK and you are done. Choose any convenient key as your gradle sync shortcut which doesnot conflict with any other shortcut key, (I have choosen Shift + 5 as my gradle sync key), so next when you want to run gradle sync manually just press this keyboard shortcut key.
在Android Studio 3.3中,它在这里:
根据Android Studio 3.1中的答案https://stackoverflow.com/a/49576954/2914140,它在这里:
该命令被移动到文件>同步项目与Gradle文件。