skip to Main Content

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)

enter image description here

3

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search