在 Android Studio 中找不到创建包菜单 [英] Cannot find the create package menu in Android Studio

查看:34
本文介绍了在 Android Studio 中找不到创建包菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 Android Studio 的风味文件夹之一下添加包:在我右键单击 java 文件夹后,我在那里看不到包"或Java 类"选项!

I have a trouble to add a package under one of the flavor folder in Android Studio: after I right click on the java folder and I could not see the 'Package' or 'Java Classes' options there!

我对另一种口味做了完全相同的事情,这很好..现在我被困在这里,不知道这是 AS 中的错误还是我在那里做了什么.请任何人帮助我!

I did exactly the same for another flavor and it was fine.. Now I am stuck here, without knowing if it is a bug in AS or I did anything there. Anyone help me please!

(我用谷歌搜索了它并没有用我迄今为止发现的东西解决它)

(I googled it and did not solve it with what I have found so far)

========编辑========

=======EDIT========

我关闭了项目并创建了一个全新的空项目,现在即使在主文件夹中,当我右键单击我添加的 java 文件夹时,我也找不到Java 类"或包".

I close the project and create a brand new empty project, now even in the main folder I cannot find the 'Java Classes' or 'Package' when I right click on the java folder I added.

但是,如果我只是在 java 下创建带有类的包的文件夹,并进行构建,它最终会识别并使 java 变成蓝色,然后我就可以看到如果我右键单击蓝色 java 文件夹,则菜单.

However, if I just create the folders of the package under java with a class there, and do a build, it will finally recognize that and make java blue color and then I am able to see the menus if I right click the blue java folder.

所以这听起来像是 AS 中的一些错误.

So it sounds like some bug in AS.

推荐答案

这可能只是您当前正确选择的构建风格来启用该风格.

It might just be the build flavor you are currently selected correctly to enable that flavor.

如果我们有两种构建风格,让我们说免费和专业.如果选择 pro 是当前构建风格.像您提到的那样,flavor free 不会显示为蓝色的 java 包,它将显示为目录结构.因此更改构建变体并使其可用.

If we have two build flavor let's say free and pro. If pro is selected is current build flavor. The flavor free will not be shown as java package in blue color as you mentioned, it will be shown as directory structure. Hence change the build variant and make it workable.

不确定您是否遇到了同样的问题,但将其分享以供其他可能遇到我现在面临的问题的人参考.

Not sure if you faced the same issue, but sharing it for reference of others who might face this issue as i faced now.

这篇关于在 Android Studio 中找不到创建包菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆