Java Gdx支付桌面无类定义错误
我使用libgdx支付Android和iOS,直到最近才能够在桌面模式下测试我的应用程序 自从升级到IntelliJ 2016.1后,我现在仅在尝试运行桌面应用程序时收到以下错误:;iOS和Android都继续成功编译和运行 错误:Java Gdx支付桌面无类定义错误,java,import,libgdx,desktop,Java,Import,Libgdx,Desktop,我使用libgdx支付Android和iOS,直到最近才能够在桌面模式下测试我的应用程序 自从升级到IntelliJ 2016.1后,我现在仅在尝试运行桌面应用程序时收到以下错误:;iOS和Android都继续成功编译和运行 错误: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/pay/PurchaseObserver
桌面和核心模块的build.gradle文件如下所示
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"
}
}
gradle ProjectName:desktop run
此外,在IntelliJ中,它报告导入PurchaseObserver
时没有错误,只有在我尝试运行应用程序时才会发生
如果有任何帮助,我们将不胜感激。这是IntelliJ本身的一个已知错误,现将其总结如下 可以在这里找到bug IntelliJ问题 只有当同时存在Android运行配置时,才会出现此错误 在修复之前,解决方法是通过命令行使用gradle,如下所示
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"
}
}
gradle ProjectName:desktop run
这也可以作为IntelliJ中的运行配置来实现