Home > Software engineering >  Unable to Initialize DesktopLauncher After Upgrading Android Studio
Unable to Initialize DesktopLauncher After Upgrading Android Studio

Time:07-02

I upgraded Android Studio from Bumblebee to Chipmunk and now I cannot run the Desktop application, it was working before the upgrade. The Android application still runs fine on my phone, it is only the desktop that is no longer working. I also tried upgrading Gradle, but still the same problem.

I created brand new LibGDX projects using the LibGDX setup application for both version 1.10 (which is what my main app is currently using) and the newer version 1.11, but still the same result. This is the error message I get when running the new test project.

Error: Unable to initialize main class com.tekker.libgdxruntest.DesktopLauncher
Caused by: java.lang.NoClassDefFoundError: com/badlogic/gdx/ApplicationListener

I have tried selecting all of the Java versions and applying them in the Desktop Configuration, but no change. enter image description here

It is also selected in the Gradle settings.

enter image description here

I suspect this is a problem with the Java JDK since the Android application is still working, but I'm not sure what else to try. Thanks.

CodePudding user response:

I got help on the LibGDX Discord by comparing IDE settings.

The fix is to select LibGDXRunTest.desktop.main from the dropdown list instead of just LibGDXRunTest.desktop.

No idea why the .main part was changed after the update. Everything was working fine before this last update so I know this was set correctly before. But it is all working now.

  • Related