[英]Android Studio - Can't see Java Directory
I tried both copy and move using file explorer in win7.我尝试在 win7 中使用文件资源管理器进行复制和移动。
I have faced the same issue, although @Igor answers fix your issue, it was different for me because the Java files are missing in the file directory.我遇到了同样的问题,虽然@Igor 的回答解决了你的问题,但对我来说是不同的,因为文件目录中缺少 Java 文件。 Same as you, I've also followed the same steps from https://developer.android.com/training/basics/firstapp/creating-project.html and there's nothing special with those steps.与您一样,我也按照https://developer.android.com/training/basics/firstapp/creating-project.html中的相同步骤进行操作,这些步骤没有什么特别之处。
I have resolved the issue by downloading the SDK quck fix in the "Messages Gradle Sync" explorer.我通过在“消息 Gradle 同步”资源管理器中下载 SDK 快速修复解决了这个问题。
After that, the java folder will appear to the project explorer.之后,java 文件夹将出现在项目资源管理器中。
I've faced a similar issue: I could see my java directory in the Android view, but not in the Project view.我遇到过类似的问题:我可以在 Android 视图中看到我的 java 目录,但在项目视图中看不到。 I finally managed to fix it by going in the menu: File > Sync Project With Gradle Files.我终于设法通过进入菜单来修复它:文件 > 将项目与 Gradle 文件同步。
Hope it helps someone.希望它能帮助别人。
Your top-level project in Android Studio should show the absolute path of the directory on your machine.您在 Android Studio 中的顶级项目应该显示您计算机上目录的绝对路径。 Look in the Project perspective (not Android perspective).查看项目透视图(不是 Android 透视图)。 Like D:\workspace\myproject .像D:\workspace\myproject 。 Go ahead and navigate into that directory with file explorer on your machine, and make sure that its java sub-directory contains classes! Go 并使用您机器上的文件资源管理器导航到该目录,并确保其 java 子目录包含类!
If you are using a library project, then you need to add below lines in gradle library level如果您使用的是图书馆项目,则需要在 gradle 图书馆级别添加以下行
android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
and you need to change the word kotlin
to java
according to folder name you already have.并且您需要根据您已有的文件夹名称将单词kotlin
更改为java
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.