Exception in thread "main" java.lang.NoClassDefFoundError:
See original GitHub issueIssue details I catch the exception when:
- I am importing my old project into a new one (the contents of the core folder root)
- in a new project, I change the main class Java file to Kotlin file
AS 3.1.3 build.gradle (Project) = classpath ‘com.android.tools.build:gradle:3.1.0’ build.gradle (Project) = classpath ‘com.android.tools.build:gradle:3.1.3’ gradle-wrapper.properties = distributionUrl=https://services.gradle.org/distributions/gradle-4.6-bin.zip gradle-wrapper.properties = distributionUrl=https://services.gradle.org/distributions/gradle-4.4-bin.zip gradle-wrapper.properties = distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip all “compile” replaced to “implementation”
If my English is too bad, then please see the video
Reproduction steps/code Create a new project. Convert the core: main Java class to Kotlin class and run Desktop. Code/Convert Java file to Kotlin file or Download tester.zip
- run desktop project = work
- uncomment the line of code
img = new AAA (). GetTexture ();
and run again = does not work (in the commented line of code, the AAA class is the Kotlin class)
Version of LibGDX and/or relevant dependencies 1.9.8 + Kotlin
Stacktrace
Exception in thread "main" java.lang.NoClassDefFoundError: com/mygdx/game/MyGdxGame
at com.mygdx.game.desktop.DesktopLauncher.main(DesktopLauncher.java:10)
Caused by: java.lang.ClassNotFoundException: com.mygdx.game.MyGdxGame
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Please select the affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
I think this is a known issue and not really caused by libgdx. Try running the desktop project from gradle task: in Android Studio open the Gradle projects panel on the right side -> :desktop -> Tasks -> application -> run
This solved the issue for me
It’s works, I don’t How/Why ?
Today again I tried to run
desktop module
using Run/Debug Configuration and it works.My project configuration :
core module
org.gradle.configureondemand=false
ingradle.properties