Jamie Craane
04/24/2020, 7:47 AMroot
android
app (Android application)
common (multiplatform module (common code, iOS, Android and JVM)
buildSrc (some custom Gradle tasks)
iosApp (The iOS application)
jvmmodule (The JVM module, this is were it is all about)
localization (some custom localization code for Android and iOS)
The project is utilizing Kotlin 1.3.72 and Gradle 6.3.
When checking out and importing the project into the IDE (Android Studio or IntelliJ) the problem is replicated by doing the following:
Scenario 1 (running from the IDE)
Actual:
- Open the MyMainClass and click the Play icon in the gutter to execute the main method
- The run window of the IDE outputs “Exception in thread “main” java.lang.NoClassDefFoundError: nl/jamiecraane/nativestarter/api/MockApi”
Expected:
- The main method is excuted and the response from the MockApi is displayed in the console
Scenario 2 (running from Gradle)
For this, we configured the Gradle application plugin to execute the MyMainClassKt. Run the following command from the command line: ./gradlew jvmmodulerun
The result of this execution is the following (as expected, without a NoClassDefFoundError)
> Task :jvmmodule:run
Hello
Response data: [Person(firstName=Jan, lastName=Janssen), Person(firstName=John, lastName=Smith)]
What can be the reason for this issue (NoClassDefFoundError when running the MyMainClass from the IDE instead of Gradle)?Jamie Craane
06/10/2020, 11:58 AM