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!
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========
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.
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.
So it sounds like some bug in AS.
example. app. data. The package for each android application resides within the src/main/java directory of the application module.
EDIT: To add a new package to android studio, click on Project -> expand the 'app' directory, expand 'src' -> expand 'main' -> right click on 'java' -> New -> Package.
Packages and folders are the same thing, there should be no problem having two packages: com. LS33Tcode. example. adapters and com.
If you develop an Android library, you can declare your package visibility needs by adding a <queries> element in your AAR manifest file.
It might just be the build flavor you are currently selected correctly to enable that flavor.
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.
Package option is available only for selected flavor. switch to desired flavor and IDE will refer that source directory and will convert it to package and directories from other flavors will be listed as normal directories tree structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With