简体   繁体   English

为什么 Project 的 build.gradle 没有显示?

[英]Why Project's build.gradle is not showing?

在此处输入图片说明

在此处输入图片说明

Why is Project's build.gradle not showing up in Android mode?为什么 Project 的 build.gradle 在 Android 模式下不显示?

Just like the picture below, the .gradle file in the project root directory can also be displayed in Android mode.就像下图一样,项目根目录下的.gradle文件也可以在Android模式下显示。 enter image description here在此处输入图片说明

You need to change it at here.您需要在此处更改它。 You choose to display the project instead the Android.您选择显示项目而不是 Android。

在此处输入图片说明

You changed the display mode.您更改了显示模式。 Notice that the first image, you configured to "Project Mode" and the second one is in "Android Mode".请注意,您配置为“项目模式”的第一个图像,第二个处于“Android 模式”。 It's on the upper-left corner of the "project" tree view.它位于“项目”树视图的左上角。

在此处输入图片说明

Your using project structure better to use android structure view您使用project结构更好地使用android结构视图

secound thing is if you want to use project structure then project->build.gradle is your project level gradle file for Ex.第二件事是,如果你想使用项目结构,那么project->build.gradle是你的项目级别的gradle file Ex. AndroidWeather/build.gradle

This can happen when the caches get messed up.当缓存弄乱时可能会发生这种情况。 Try this:尝试这个:

  • Close the project in Android Studio在 Android Studio 中关闭项目
  • Delete the .idea folder in the project folder:删除项目文件夹中的.idea文件夹:
  • In Android Studio, File / New / Import Project... and select the folder of the project在 Android Studio 中,File / New / Import Project... 并选择项目所在的文件夹

Note, to delete the folder:注意,要删除文件夹:

cd /path/to/project
rm -rf .idea

Now you should see the project-level build.gradle in the Android scope.现在您应该在 Android 范围内看到项目级别的 build.gradle。

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

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