简体   繁体   English

Android Studio - 缺少 Android 项目视图

[英]Android Studio - Android Project View is Missing

在此处输入图片说明

I've found some webpage but it does not guide me back to normal android project view.我找到了一些网页,但它没有引导我回到正常的 android 项目视图。 http://developer.android.com/sdk/installing/studio-androidview.html http://developer.android.com/sdk/installing/studio-androidview.html

I did File => Other Settings => Default Project Structure => Default Settings => OK It make even worse, import library become not function-able.我做了File => Other Settings => Default Project Structure => Default Settings => OK更糟糕的是,导入库变得无法运行。

I also had this problem (creating new project also looked similar to IntelliJ IDEA), got it fixed when I enabled some Android-related plugins.我也有这个问题(创建新项目看起来也类似于 IntelliJ IDEA),当我启用一些与 Android 相关的插件时得到了解决。

Go to Preferences ( Settings on Windows and Linux) > Plugins and enable Android Support , at a minimum.转至Preferences (Windows 和 Linux 上的设置)> Plugins并至少启用Android Support

Now you will have "Android" option in the Project View .现在您将在Project View 中有“Android”选项。

Try:尝试:

View -> Tool Windows -> Project OR the shortcut is alt+1 .查看 -> 工具窗口 -> 项目或快捷方式是alt+1

If that's not working try:如果这不起作用,请尝试:

Window -> Restore Default Layout OR the shortcut is shift+F12 . Window -> Restore Default Layout或快捷键是shift+F12

Also, check that Studio is up to date:另外,检查 Studio 是否是最新的:

Help -> Check for update...帮助 -> 检查更新...

android studio 左下角的方块可让您展开屏幕或使用侧边菜单填充屏幕。

The square at the bottom left corner of android studio lets you spread the screen or it populates it with side menus. android studio 左下角的方块可让您展开屏幕或使用侧边菜单填充屏幕。

For me, it happened when I used Kotlin KTS for Gradle files, but created a java library module for this project.对我来说,当我将 Kotlin KTS 用于 Gradle 文件时发生了这种情况,但为这个项目创建了一个 java 库模块。 After trying to reimport project I got an error:尝试重新导入项目后,出现错误:

New Gradle Sync is not supported due to containing buildSrc module由于包含 buildSrc 模块,不支持新的 Gradle 同步


Solution :解决方案
Migrate added module to kts将添加的模块迁移到 kts
Remove created by Wizard settings.gradle , if you already use settings.gradle.kts删除由 Wizard settings.gradle创建的,如果您已经使用settings.gradle.kts
Reimport project重新导入项目
File -> Close project文件-> 关闭项目
Android Studio : import project Android Studio :导入项目
Show it your current project location显示您当前的项目位置

Just had the problem happen to me again.刚刚有问题再次发生在我身上。 I got the problem solved, but unfortunately I can't confirm the solution, now that it's fix;我解决了问题,但不幸的是我无法确认解决方案,现在已经解决了; but I have strong suspicions on what was the cause.但我强烈怀疑是什么原因。

In my case, the problem occurred as a result of reorganizing my project directory.就我而言,问题是由于重新组织了我的项目目录而发生的。 My projects are stored in given directory lets call it "Projects".我的项目存储在给定的目录中,我们称之为“项目”。 I renamed that fold to "ProjectsBackup" and created a new "Projects" directory.我将该折叠重命名为“ProjectsBackup”并创建了一个新的“Projects”目录。 I then moved selected projects now contained in the "ProjectBackup" directory to the new "Projects" directory.然后,我将现在包含在“ProjectBackup”目录中的选定项目移动到新的“Projects”目录。 After moving the first project, I used Android Studio to open that project.移动第一个项目后,我使用 Android Studio 打开该项目。 That's when the problem occurred.这时候问题就出现了。 I got a message that it couldn't find the gradle-wrapper and offered me the choice to create it.我收到一条消息,说它找不到 gradle-wrapper 并让我选择创建它。 The gradle-wrapper is stored in a directory call "gradle" and its stored in the "Projects" directory. gradle-wrapper 存储在名为“gradle”的目录中,并存储在“Projects”目录中。 I had not copied that directory over from the "ProjectsBackup" to the new "Projects" directory.我没有将该目录从“ProjectsBackup”复制到新的“Projects”目录。 At the time, I thought nothing about that since, a new one was created.当时,我什么也没想到,因为创建了一个新的。 After trying all the various suggestion in this problem discussion, android studio offered a notification from me to update my "android gradle" plugin.在尝试了此问题讨论中的所有各种建议后,android studio 提供了我的通知以更新我的“android gradle”插件。 I did the update and after that the "android" view was now available for me to select.我进行了更新,之后“android”视图现在可供我选择。 The android gradle update fixed the problem. android gradle 更新解决了这个问题。

I unfortunately, can't tell you what changed as a result of the update, nor can I tell you how you can force Android Studio to update or reinstall the android gradle plugin.不幸的是,我无法告诉您更新后发​​生了什么变化,也无法告诉您如何强制 Android Studio 更新或重新安装 android gradle 插件。 All I can tell you is that I got lucky that android studio gave me that notification to update the android gradle plugin.我只能告诉你,我很幸运,android studio 给了我更新 android gradle 插件的通知。 Things like "file/project structure" and changing the Android Gradle Plugin Version, didn't fix the problem.诸如“文件/项目结构”和更改 Android Gradle 插件版本之类的事情并没有解决问题。 What I did notice, was that when I first looked at that, the drop-down list of android gradle versions was an empty list.我注意到的是,当我第一次看到它时,android gradle 版本的下拉列表是一个空列表。 I manually put one in "3.6.3", but it didn't help.我手动将一个放在“3.6.3”中,但没有帮助。 If you run into this problems I would suggest you look at the dates of the two file in the "wrapper" directory and compare those to projects you may have that are working correctly with the android view.如果您遇到此问题,我建议您查看“wrapper”目录中两个文件的日期,并将它们与您可能拥有的在 android 视图中正常工作的项目进行比较。 I wish I would have checked the date of the wrapper jar file, when it wasn't working.我希望我能检查包装器 jar 文件的日期,当它不工作时。 That's what I think might have been wrong (ie I got a wrapper.jar file that was incompatible with my version of android studio - unfortunately I can't prove that)这就是我认为可能是错误的(即我得到了一个与我的 android studio 版本不兼容的 wrapper.jar 文件 - 不幸的是我无法证明这一点)

上述解决方案都不适合我,所以我通过从我的项目中删除.gradle.idea文件夹来解决这个问题。

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

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