6

I build a module in Kotlin, then import in my project. I put minifyEnabled false in module's build.gradle file. But unable to see the source code or unable to put a breakpoint.

It's working with Java but not with Kotlin.

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Azay Gupta
  • 281
  • 2
  • 16

1 Answers1

1

Maybe it's still helpful for someone.

To see the Kotlin sources you'll need to have a sources.jar, besides the .aar file. To do that you can add the following in the .gradle file where you make your maven publishing

task androidSourcesJar(type: Jar) {
    archiveClassifier = 'sources'
    from (android.sourceSets.main.java.sourceFiles, android.sourceSets.main.kotlin.sourceFiles)
}

artifacts {
    archives androidSourcesJar
}

This will generate a sources.jar file in your <<library name>>/build/libs.

Then you can include this jar file along with your .aar library file. It seems like Android Studio knows how to download the sources for .jar automatically, but if not, you can download them and then use the Choose sources option in the toolbar above the code.

rrs
  • 11
  • 1