# Missing module on multiplatform project

**URL:** <https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491>\
**Category:** Multiplatform\
**Created:** [October 13, 2020, 6:50pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491 "2020-10-13T18:50:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![canemacchina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/canemacchina/32/7470_2.png) [@canemacchina](https://discuss.kotlinlang.org/u/canemacchina)\
**Post date:** [October 13, 2020, 6:50pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/1 "2020-10-13T18:50:51Z")

</div>

Why in a fresh created project androidMain and androidTest are not shown as modules?  
I can see them if I switch to Project view, but from AndroidView are not recognized as modules.

---

<div class="post-metadata">

**Author:** ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)\
**Post date:** [October 13, 2020, 8:40pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/2 "2020-10-13T20:40:46Z")

</div>

Yeah it’s a visual issue. The module is there and works just fine, it’s just not highlighted in the IJ IDEA Project Structure!

have a look [here](https://discuss.kotlinlang.org/t/androidmain-and-android-tests-folder-not-recognised-as-module/19203/2)

---

<div class="post-metadata">

**Author:** ![canemacchina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/canemacchina/32/7470_2.png) [@canemacchina](https://discuss.kotlinlang.org/u/canemacchina)\
**Post date:** [October 14, 2020, 2:22pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/3 "2020-10-14T14:22:18Z")

</div>

I know it’s just a visibility issue, but it hurts me a lot!  
And I’ve read your answer before, but as I’m a newbie on android, gradle and multiplatform projects, I don’t know how to apply your workaround 😅

---

<div class="post-metadata">

**Author:** ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)\
**Post date:** [October 14, 2020, 7:18pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/4 "2020-10-14T19:18:36Z")

</div>

Add this to your `build.gradle.kts`:

```kotlin
android {
    ...
    sourceSets.all {
        java.srcDirs(file("src/android${name.capitalize()}/kotlin"))
        res.srcDirs(file("src/android${name.capitalize()}/res"))
        resources.srcDirs(file("src/android${name.capitalize()}/resources"))
        manifest.srcFile(file("src/android${name.capitalize()}/AndroidManifest.xml"))
    }
}

```

It will add `src/androidMain/kotlin`, `src/androidMain/res`, `src/androidMain/resources` to your project, as well for `androidTest` and or whatever flavor you have!

---

<div class="post-metadata">

**Author:** ![canemacchina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/canemacchina/32/7470_2.png) [@canemacchina](https://discuss.kotlinlang.org/u/canemacchina)\
**Post date:** [October 15, 2020, 10:03am UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/5 "2020-10-15T10:03:57Z")

</div>

mmm. It adds me a “java” source folder with the source code, not “androidMain” and “androidTest” as modules.

I notice another thing: If I open the project structure dialog, I cannot open the “modules” section. It displays nothing…

The problem seems that androidMain and androidTest are not recognized as modules. In fact, if I open android studio .iml files, those two projects are missing.

---

<div class="post-metadata">

**Author:** ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)\
**Post date:** [October 15, 2020, 10:36am UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/6 "2020-10-15T10:36:22Z")

</div>

> [@canemacchina](#):
>
> mmm. It adds me a “java” source folder with the source code, not “androidMain” and “androidTest” as modules.

Trust me, they are there. Create the folders and start writing code, IJ IDEA will start working.

As I said in the other thread, all the information about where source code is and how to compile it is declared via Gradle scripts and its plugins. When syncing, IntelliJ basically tries to understand how you set up the plugins and builds a UI to let you understand that model.

Now, you applied 2 big plugins which are the Android one and the K/MP one. Both of them set up the project in different ways which are often overlapping for some folder/sources. Sometimes IJ IDEA is just unsure to what show or what not to. The icons for the modules when applying both plugins are one.

Nonetheless, Gradle may build just fine (unless yo uscrewed up the build file 😛) ! It’s not IJ IDEA that builds, it’s Gradle! So even if an icon is offset, the build will go just fine.

Why the module is not properly recognized by IJ IDEA, but the sources are correctly solved by the IDE, it’s a question that only JB itself can answer. What I always found bothering were the Android sources not aligned with the rest of the K/MP scaffolding…

---

<div class="post-metadata">

**Author:** ![canemacchina](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/canemacchina/32/7470_2.png) [@canemacchina](https://discuss.kotlinlang.org/u/canemacchina)\
**Post date:** [October 15, 2020, 3:24pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/7 "2020-10-15T15:24:14Z")

</div>

Sure, I know they are there. I’m a newbie on gradle and android development, but I can see that the project compile and run perfectly both on iOS and Android, and I understand perfectly that is just a “visualization issue”.  
The problem is that it hurts me a lot and break my Zen! 😅

Seriously, what I don’t understand is why after synching with gradle, .iml file for androidMain and androidTest are not created. Cannot I simply fix creating those file by hand?

---

<div class="post-metadata">

**Author:** ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)\
**Post date:** [October 15, 2020, 5:04pm UTC](https://discuss.kotlinlang.org/t/missing-module-on-multiplatform-project/19491/8 "2020-10-15T17:04:45Z")

</div>

They will be deleted on the next sync! Try searching in the IJ iDEA issue tracker if there’s already something. Probably there is!
