简体   繁体   中英

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. Is there an alternative to this function?

As alternative you can use Refresh all Gradle projects button in Gradle tool window.

I also have not found this button so I made my own :)

  1. Open Gradle tool window with View -> Tool Windows -> Gradle
  2. Start Macro Recording with Edit -> Macros -> Start Recording Macro
  3. In Gradle tool window press Refresh all Gradle projects button
  4. Stop Macro Recording with Edit -> Macros -> Stop Recording Macro
  5. Save Macro with name Gradle sync
  6. Press with right mouse button on IntelliJ IDEA toolbar and choose Customize Menus and Toolbars...
  7. Under Main menu -> Edit -> Macros -> Macro Actions find your Gradle sync Macro, select it and press Edit Action Icon...
  8. 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
  9. Now in Menus and Toolbars select last item in Main Toolbar group, press Add After... and select All actions -> Macros -> Gradle sync
  10. Now you have Sync Project with Gradle Files button!

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.

"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.

Another method is as mentioned by "Avi Arro"

The Gradle sync is still there, under Tools -> Android -> Sync with Gradle

If you don't see it, then Intellij needs to re-link your gradle file.

Try closing the project, re-opening by File -> Import Project -> and select your .gradle file

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.

Go to File > Settings > Plugin > Android support(Tick this).

and sync your project.

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.

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. I'm new to Android, so I had no idea to fix this. What I did was I cleared the AS cache.

File > Invalidate Caches / Restart

Voila! The Gradle sync button is now there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM