Search code examples
androidgradlekotlinmaven-3

Cannot find Kotlin typealias in multi-module Android project


I'm working on a multi-module project and the project is no longer compiling. The setup is that some modules are in another git repo (repo "A") and publish the modules' AAR outputs to maven. Then the other git repo (repo "B") pulls in those AARs via maven.

It worked yesterday before I started moving over more modules from one repo to another (it's a multi phase effort). It's currently failing because one module in repo "A" creates a Kotlin typealias and another module in repo "B" tries to use that typealias. Now, it cannot find the typealias in repo "B"'s module.

I have looked in the resulting AAR and see the typealias defined where I expect.

Does a Kotlin typealias need some kind of special setup to be used from an AAR?


Solution

  • You should add the following to your module's build.gradle file:

    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'