The structure project window does not show all the options and I can not add libraries or modules.
Check the image:
And this is how it should look with all the options:
I try to fix that reinstalling androidstudio, but it didn't work.
I'm using Android Studio 2.9 and i already have working ABS, but i can't make work HoloEverywhere
Is there any solution for this problem?
Beforehand, thanks
Do Right Mouse Click on visible package, then select 'Open Module Settings' - it will give you ability to add Module.
I added a screenshot to show exacly what I mean.
It's a workaround but it give you ability to add module to project
Related
I'm writing a Kotlin Multiplatform project in Android Studio. As a result, I have multiple sourceSets configured in the project but some of them are empty. Removing them from the Gradle build is not possible as they are required for building the project. Is there a way to hide them from being displayed by the IDE?
(Android Studio Dolphin | 2021.3.1 Patch 1)
There is no built-in way to hide empty source sets, but you can create a custom annotation to do this.
Here is the Example. I Hope It would help you.
#Target(AnnotationTarget.CLASS)
#Retention(AnnotationRetention.SOURCE)
annotation class HideEmptySourceSet
For more details about annotations check this link:
https://kotlinlang.org/docs/annotations.html
Click the dropdown at the top labeled "Android" and select the "Project" view instead. This will display only the directories that are actually present on the filesystem rather than showing every source set that's configured.
Unfortunately there is no such option built-in in Android Studio environment.
It's also possible to use a different view (e.g. Project) or define bookmarks and favourites to navigate around quickly.
I would advise to try out the favourites, as setting up will take about 3 minutes and will make it way more comfortable to use.
I've started today with Android Jetpack Compose. At the beginning it worked all fine. On some classes you just have to watch that you get the right package. But on some Point I've messed something up an I don't know what. I've just wanted to Import a package and then some context menu popped up, I accidentally pressed 'Ok' and since then the "Import" doesn't show up anymore when I write a class from a compose package.
There is surely an option I've turned off but I don't know what. Can anyone help me with this?
Go to file > Settings in Android Studio then search in the settings for "imports".
Under editor click Auto Import and scroll down to the bottom.
The check the two boxes for Kotlin as shown here:
.
FIXED IN AS 2.2.1
After update Android Studio to the 2.2 I've got this problem. It's hard to use such format with a small 13-inch display.
In Project view and Android view I get folders name as full packages name but I want to see just names of the directories:
I tried to search for this problem, but I only find "Compact empty middle packages" which impact only for a top level folder.
"Flatten packages" option creates tons of the directories, for every package making everything even worse:
One more screenshot:
In the Package/ Project or Androidview etc, Go to the gear icon on the right side and uncheck Flatten Packages and Compact Empty Middle Packages. This should show you the break down by directory instead of flattening it.
Note: This has now been fixed in Android Studio 2.2.1
AOSP - Issue Tracker:
Project structure view is showing full package names for sub packages when data binding is enabled.
https://code.google.com/p/android/issues/detail?id=222914
Check this configuration if Flatten Packages is not your desired solution:
Hope it will help
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.
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.
I found this Solution.
File > Project Structure > Select the lib folder > Click on Sources > Apply and Okay
Now you can see the new package option by right clicking the lib folder, the new package option will be shown.
Step1
Step2
Step3
Control click (mac), or right click the /java directory and select Mark Directory As -> Source Root. You should then be able to right click the /java directory and select -> New -> Package. Your java directory will also appear blue.
Solution. File- Project Structure- Modules- Right click on lib - Select Sources.
then the option "Package" will appear on your list.
I am unable to see the folders that are physically existing, this is the case.
But in actual fact I have other folders as welll
So what can I do?
Above your the file directory view in Android Studio is a drop down which currently is most likely set to Android. Change it to Project and you should be able to see all your files.
I tried the all the approaches mentioned above but can't fix rather than fix it by a hardcore approach -
Step 1. Close your Android studio.
Step 2. Delete .gradle and .idea folder from your project directory.
Step 3. Open your project and you will see the files again.
go to View menu then click tool window then after click on project
view->toolwindow->project
it worked for me
for me doing the following works:
from menu go to: View--->tool windows ---> Project
then click the little gears icon (settings) you will see an option to change the empty middle packages. it looks like this:
disable "Hide Empty Middle Packages" under the Project View settings dropdown and then it should make everything show up.
If anyone ever does what I did maybe this will help:
Android Studio does not like it when module names begin with a number. I was learning from some tutorials and named the first module "1-name" and the next one "2-name". Setup was fine and it ran, but only the "Gradle" Scripts entry would show in the navigation window in "Android" mode.