简体   繁体   English

Android Studio 3 中的“与 gradle 文件同步项目”按钮在哪里?

[英]Where is a "Sync project with gradle files" button in Android Studio 3?

This button disappeared from a new 3.1 version of AS Toolbar.这个按钮从新的 3.1 版本的 AS Toolbar 中消失了。 Before it showed as:之前它显示为: 在此处输入图像描述

Now it's missing:现在它不见了:

在此处输入图像描述

EDIT : They like to keep playing with the toolbar.编辑:他们喜欢继续玩工具栏。

Since Android Studio 3.3, the icon has been updated and moved back across to the right:自 Android Studio 3.3 起,图标已更新并移回右侧:

在此处输入图片说明


Original answer:原答案:

It hasn't disappeared.它并没有消失。 They have just moved it between the Save and Sync files button on the far left end of the toolbar.他们刚刚在工具栏最左端的“保存和同步文件”按钮之间移动了它。

在此处输入图片说明

In Android Studio 3.3 it is here:Android Studio 3.3 中,它在这里:

在此处输入图片说明

Is is available from menu.是可从菜单。 Tools > Android disappeared, so find it in File > Sync Project with Gradle Files . Tools > Android消失了,所以在File > Sync Project with Gradle Files找到它。

在此处输入图片说明

For me I did following to make it visible:对我来说,我做了以下工作以使其可见:

  1. Go to File -> settings -> Menus and Tool bar as shown转到文件 -> 设置 -> 菜单和工具栏,如图所示这里
  2. Click on Restore Default点击恢复默认

You should see the Updated Android.MainToolBarGradleGroup as follows:您应该看到 Updated Android.MainToolBarGradleGroup 如下: 更新菜单

  1. Click on Apply and restart the Android Studio单击应用并重新启动 Android Studio

File > Sync Project With Gradle Files or this shortcut.文件 > 同步项目与 Gradle 文件或此快捷方式。

在此处输入图片说明

If you encounter this issue within a Flutter project and you cannot find the sync method, you can click on the build.gradle file and then click on Open for Editing with Android Studio at the top right.如果你在 Flutter 项目中遇到这个问题,找不到同步方法,可以点击 build.gradle 文件,然后点击右上角的 Open for Editing with Android Studio。 This will open just the Android project in a new Android Studio window and you will be able to see all the Gradle commands then (for example, under File > Sync...).这将在新的 Android Studio 窗口中仅打开 Android 项目,然后您将能够看到所有 Gradle 命令(例如,在 File > Sync... 下)。

If you are creating React Native application, make sure that you opened your project in ~/YourProjectName/android folder如果您正在创建 React Native 应用程序,请确保您在~/YourProjectName/android文件夹中打开了您的项目

You can use this shortcut Ctrl + Shift + A to get not only sync but also other action if you found trouble to get them.A window will appear 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 on the menu.只需在其中输入“sync”,它就会找到命令Sync Project with Gradle Files ,即使它在菜单上不可见。

In Android Studio under 3.1 it's placed in在 3.1 下的 Android Studio 中,它被放置在

Tools > Android > Sync Project with Gradle Files工具 > Android > 将项目与 Gradle 文件同步

I had to open /android/ on its own in Android Studio (you can click Open for Editing in Android Studio in the top right corner) and then you have this options in the toolbar and in File/Synch Project with Gradle Files (when viewing .gradle file).我必须在 Android Studio 中单独打开/android/ (您可以单击右上角的 Open for Editing 在 Android Studio 中),然后您可以在工具栏和带有 Gradle 文件的 File/Synch Project(查看.gradle 文件)。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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