[英]Can't find “Sync Project with Gradle Files” button in IntelliJ IDEA
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.我刚刚将
google-play-services-lib
库添加到我的项目中,但卡在我需要“将项目与 gradle 文件同步”的地方,但 IntelliJ 13.0.1 上不存在此按钮。 Is there an alternative to this function?这个功能有替代品吗?
As alternative you can use Refresh all Gradle projects
button in Gradle tool window.作为替代方案,您可以使用 Gradle 工具窗口中的“
Refresh all Gradle projects
按钮。
I also have not found this button so I made my own :)我也没有找到这个按钮,所以我自己做了:)
View -> Tool Windows -> Gradle
View -> Tool Windows -> Gradle
打开 Gradle 工具窗口Edit -> Macros -> Start Recording Macro
Edit -> Macros -> Start Recording Macro
Refresh all Gradle projects
buttonRefresh all Gradle projects
按钮Edit -> Macros -> Stop Recording Macro
Edit -> Macros -> Stop Recording Macro
停止宏录制Edit -> Macros -> Stop Recording Macro
Gradle sync
Gradle sync
保存宏Customize Menus and Toolbars...
Customize Menus and Toolbars...
Main menu -> Edit -> Macros -> Macro Actions
find your Gradle sync
Macro, select it and press Edit Action Icon...
Main menu -> Edit -> Macros -> Macro Actions
找到您的Gradle sync
宏,选择它并按Edit Action Icon...
Menus and Toolbars
select last item in Main Toolbar
group, press Add After...
and select All actions -> Macros -> Gradle sync
Menus and Toolbars
栏中选择Main Toolbar
组中的最后一项,按Add After...
并选择All actions -> Macros -> Gradle sync
Sync Project with Gradle Files
button!Sync Project with Gradle Files
按钮!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.有一个有用的快捷键Ctrl + Shift + A ,之后会出现一个窗口,您可以键入一些您希望 IntelliJ 运行的命令。 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.
只需在其中输入“sync”,它就会找到命令Sync Project with Gradle Files ,即使它在菜单中不可见。
"Sync Project with Gradle Files" is not present in IntelliJ. IntelliJ 中不存在“使用 Gradle 文件同步项目”。 However a similar option is available to build all the gradle files together.
但是,可以使用类似的选项将所有 gradle 文件构建在一起。 Go to View --> Tool Windows --> Gradle.
转到查看 --> 工具窗口 --> Gradle。 A Gradle task panel gets displayed in the right side with the list of apps.
Gradle 任务面板与应用程序列表一起显示在右侧。 Select your app and click the "Refresh all Gradle projects" in the top bar of the Gradle task panel.
选择您的应用程序,然后单击 Gradle 任务面板顶部栏中的“刷新所有 Gradle 项目”。
Another method is as mentioned by "Avi Arro"另一种方法是“Avi Arro”提到的
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 文件
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.并同步您的项目。
I haven`t seen such option in pure IntelliJ.我还没有在纯 IntelliJ 中看到这样的选项。 I guess you are developing some android app.
我猜你正在开发一些 android 应用程序。 You should then switch to Android Studio (based on IntelliJ) where this option is available for sure.
然后你应该切换到 Android Studio(基于 IntelliJ),这个选项肯定是可用的。
http://developer.android.com/sdk/installing/studio.html http://developer.android.com/sdk/installing/studio.html
Just in case someone who uses Android studio is experiencing this issue (can't find sync gradle feature), I'm posting my answer here.以防万一使用 Android Studio 的人遇到此问题(找不到同步 gradle 功能),我将在这里发布我的答案。 I'm new to Android, so I had no idea to fix this.
我是 Android 新手,所以我不知道要解决这个问题。 What I did was I cleared the AS cache.
我所做的是清除了 AS 缓存。
File > Invalidate Caches / Restart
Voila!瞧! The Gradle sync button is now there.
Gradle 同步按钮现在就在那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.