简体   繁体   中英

Gdx pay desktop no class defined error

I am using libgdx pay for Android and iOS, and was until recently able to test my application in desktop mode.

Since upgrading to IntelliJ 2016.1, I now receive the following error only when trying to run the desktop application; both iOS and Android continue to compile and run successfully.

The error:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/pay/PurchaseObserver

My build.gradle file for the desktop and core modules looks as below;

allprojects {
  apply plugin: "eclipse"
  apply plugin: "idea"

  version = '1.0'
  ext {
      appName = '####'
      gdxVersion = '1.9.2'
      roboVMVersion = '1.8.0'
      box2DLightsVersion = '1.4'
      ashleyVersion = '1.4.0'
      aiVersion = '1.5.0'
      gdxpayVersion = '0.6.0'
  }

  repositories {
      mavenCentral()
      maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
      maven { url "https://oss.sonatype.org/content/repositories/releases/" }
  }
}

project(":core") {
  apply plugin: "java"


  dependencies {
      compile "com.badlogicgames.gdx:gdx:$gdxVersion"
      compile "de.tomgrill.gdxtwitter:gdx-twitter-core:0.1.0-SNAPSHOT"

      compile "com.badlogicgames.gdxpay:gdx-pay:$gdxpayVersion"
      compile "com.badlogicgames.gdxpay:gdx-pay-client:$gdxpayVersion"
  }
}

project(":desktop") {
  apply plugin: "java"


  dependencies {
    compile project(":core")

    compile "de.tomgrill.gdxtwitter:gdx-twitter-desktop:0.1.0-SNAPSHOT"

    compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
  }
}

Furthermore, within IntelliJ it reports no error in being able to import the PurchaseObserver , it only occurs when I try to run the application.

Any help would be appreciated.

This is a known bug of IntelliJ itself, which is summarised here http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=21148&hilit=intellij

The bug IntelliJ issue can be found here https://youtrack.jetbrains.com/issue/IDEA-147788

The bug only occurs when there is also an Android run configuration.

Until it is fixed a workaround is to use gradle via the command line, as below;

gradle ProjectName:desktop run

This can also be implemented as a run configuration in IntelliJ.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM