https://kotlinlang.org logo
#android
Title
# android
l

lawlorslaw

05/27/2018, 8:52 PM
can i access the main function from within a file in the
java
directory? if so, how do i do that?
a

Allan Wang

05/27/2018, 10:41 PM
If you type, you should be able to see that you can view classes between the Java and kotlin folders. Both should be part of your src directory. In this case, your main function is not static, so you'd need an instance of your class to call it. For an actual main method, you can wrap it in a companion object and label it as jvm static, or write it outside of the class entirely
l

lawlorslaw

05/28/2018, 7:13 PM
so my issue was i didnt add sourceSets to build.gradle
it now works as expected when i set up a companion object