First, I'm simply trying to get AspectJ to pick up my compiled Kotlin classes. While trying to do this, I ran across a post that said the OP was able to get AspectJ to pick up Kotlin files by adding this to the end of their modules build.gradle:
sourceSets.main.output.classesDir = sourceSets.main.output.classesDir.toString().replace("java", "kotlin")
But that gives me an error:
Could not get unknown property 'main' for SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer.
I've tried adding the sourceSet
main
to the android DSL container, and all of the code lives in <module>/src/main/java/
, so I'm really not sure what the deal is.
I'm having a hard time visualizing your project structure. However I was getting the same error recently (nothing to do with AspectJ though). The problem is that the main source set in sourceSets.main
is unresolved within Android projects (it is a valid source set within Java projects, which is what I was copying my original code from). To fix this, I changed: sourceSets.main.
to android.sourceSets.main.
to reference the actual main source set within Android projects.
Let me know if this works out! And if it doesn't, consider maybe adding a bit more detail to how your project is set up?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With