https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
w

Wes Cook

12/14/2023, 10:20 PM
what is the simplest way to run code that is inside commonMain without running the consuming app (but using the class path specific in my kmp project) from the terminal or inside Android Studio? If I put in a main function, AS puts a green arrow next to it, but clicking that just shows “nothing here”. I’ve tried making a class with a main function in my androidMain source, and I can configure a Run Configuration for that, but when I run it I just get a ClassNotFoundException.
j

jw

12/14/2023, 10:24 PM
Add a JVM or JS+node target
Then the pkay button should work (by promting which target you want to run)
w

Wes Cook

12/14/2023, 11:41 PM
thx @jw. Are you saying I need to add this JVM target (JRE) to the androidMain Run Configuration or the one pointing to commonMain?
ah, nvm. Added
jvm()
to the
kotlin  {}
block in the gradle file.
👍 1
3 Views