Android 在 IntelliJ IDEA 中找不到“将项目与 Gradle 文件同步”按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20815998/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't find "Sync Project with Gradle Files" button in IntelliJ IDEA
提问by Ojonugwa Jude Ochalifu
I just added the google-play-services-lib
library to my project and am stuck where I need to "sync the project with gradle files", but this button does not exist on IntelliJ 13.0.1. Is there an alternative to this function?
我刚刚将google-play-services-lib
库添加到我的项目中,但卡在需要“将项目与 gradle 文件同步”的地方,但 IntelliJ 13.0.1 上不存在此按钮。这个功能有替代品吗?
回答by mixel
As alternative you can use Refresh all Gradle projects
button in Gradle tool window.
作为替代方案,您可以使用Refresh all Gradle projects
Gradle 工具窗口中的按钮。
I also have not found this button so I made my own :)
我也没有找到这个按钮,所以我自己做了:)
- Open Gradle tool window with
View -> Tool Windows -> Gradle
- Start Macro Recording with
Edit -> Macros -> Start Recording Macro
- In Gradle tool window press
Refresh all Gradle projects
button - Stop Macro Recording with
Edit -> Macros -> Stop Recording Macro
- Save Macro with name
Gradle sync
- Press with right mouse button on IntelliJ IDEA toolbar and choose
Customize Menus and Toolbars...
- Under
Main menu -> Edit -> Macros -> Macro Actions
find yourGradle sync
Macro, select it and pressEdit Action Icon...
- Download this icon Sync Project With Gradle Files icon(from documentation http://developer.android.com/google/play-services/setup.html) and select this icon in IDEA dialog window
- Now in
Menus and Toolbars
select last item inMain Toolbar
group, pressAdd After...
and selectAll actions -> Macros -> Gradle sync
- Now you have
Sync Project with Gradle Files
button!
- 打开 Gradle 工具窗口
View -> Tool Windows -> Gradle
- 开始宏录制
Edit -> Macros -> Start Recording Macro
- 在 Gradle 工具窗口中按下
Refresh all Gradle projects
按钮 - 停止宏录制
Edit -> Macros -> Stop Recording Macro
- 用名称保存宏
Gradle sync
- 在 IntelliJ IDEA 工具栏上用鼠标右键按下并选择
Customize Menus and Toolbars...
- 在
Main menu -> Edit -> Macros -> Macro Actions
找到您的Gradle sync
宏下,选择它并按Edit Action Icon...
- 下载此图标Sync Project With Gradle Files 图标(来自文档http://developer.android.com/google/play-services/setup.html)并在 IDEA 对话框窗口中选择此图标
- 现在在
Menus and Toolbars
选择Main Toolbar
组中的最后一项,按下Add After...
并选择All actions -> Macros -> Gradle sync
- 现在你有
Sync Project with Gradle Files
按钮了!
回答by Matt Leonowicz
There is a useful shortcut Ctrl+ Shift+ A, after which a window appears and you can type some command that you would like IntelliJ to run. Just type "sync" in there and it will find that command Sync Project with Gradle Files, even if it's not visible in the menu.
有一个有用的快捷方式Ctrl+ Shift+ A,之后会出现一个窗口,您可以键入一些您希望 IntelliJ 运行的命令。只需在其中输入“sync”,它就会找到命令Sync Project with Gradle Files,即使它在菜单中不可见。
回答by Greg Ennis
The Gradle sync is still there, under Tools -> Android -> Sync with Gradle
Gradle 同步仍然存在,在 Tools -> Android -> Sync with Gradle
If you don't see it, then Intellij needs to re-link your gradle file.
如果你没有看到它,那么 Intellij 需要重新链接你的 gradle 文件。
Try closing the project, re-opening by File -> Import Project -> and select your .gradle file
尝试关闭项目,通过 File -> Import Project -> 重新打开并选择您的 .gradle 文件
回答by sid_09
"Sync Project with Gradle Files" is not present in IntelliJ. However a similar option is available to build all the gradle files together. Go to View --> Tool Windows --> Gradle. A Gradle task panel gets displayed in the right side with the list of apps. Select your app and click the "Refresh all Gradle projects" in the top bar of the Gradle task panel.
IntelliJ 中不存在“将项目与 Gradle 文件同步”。但是,可以使用类似的选项将所有 gradle 文件构建在一起。转到查看 --> 工具窗口 --> Gradle。Gradle 任务面板与应用程序列表一起显示在右侧。选择您的应用程序,然后单击 Gradle 任务面板顶部栏中的“刷新所有 Gradle 项目”。
Another method is as mentioned by "Avi Arro"
另一种方法是“Avi Arro”提到的
回答by B.shruti
In my Case, One of My plugin, Android support got disabled due to some reason , As soon as I enabled it , and sync it the button automatically showed.
在我的案例中,我的插件之一,由于某种原因,Android 支持被禁用,一旦我启用它,并同步它,按钮就会自动显示。
Go to File > Settings > Plugin > Android support(Tick this).
转到文件 > 设置 > 插件 > Android 支持(勾选此项)。
and sync your project.
并同步您的项目。
回答by Aleksander Lech
I haven`t seen such option in pure IntelliJ. I guess you are developing some android app. You should then switch to Android Studio (based on IntelliJ) where this option is available for sure.
我还没有在纯 IntelliJ 中看到这样的选项。我猜你正在开发一些 android 应用程序。然后你应该切换到 Android Studio(基于 IntelliJ),这个选项肯定是可用的。