繁体   English   中英

Libgdx gradle项目无法编译

[英]Libgdx gradle project fail to compile

我正在为我的项目添加一些代码,它工作正常,直到我再次运行它并给我这个错误消息:

4:46:46 PM: Executing external task 'run'...
Configuration on demand is an incubating feature.
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\me\Desktop\myProject\core\src\com\thiIsme\project\World\WorldController.java:10: error: package com.sun.xml.internal.bind.v2.runtime.reflect.opt does not exist
import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const;
                                                       ^
1 error
1 warning
:core:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':core:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.74 secs
Compilation failed; see the compiler error output for details.
4:46:47 PM: External task execution finished 'run'.

我很确定我收到的错误不是因为我新添加的代码,因为我对此进行了评论。

错误:包com.sun.xml.internal.bind.v2.runtime.reflect.opt不存在

从您的错误,以下jar丢失。 所以将这个jar添加到你的dependencies 希望它能解决你的问题。

// https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11'

UPDATE1:

在您的项目中,您将获得build.gradle文件。 打开它,会有一部分名为依赖项。 您必须在依赖项中添加该行。

如果以前的条件如下:

dependencies {
    compile group: 'log4j', name: 'log4j', version: '1.2.17'
}

添加此jar文件后,它将如下所示

dependencies {
    compile group: 'log4j', name: 'log4j', version: '1.2.17'
    compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11' // This portion is added
}

资源位置:

要了解有关gradle的更多信息,您可以阅读以下教程:

  1. 在Eclipse IDE中使用Gradle构建系统 - 教程
  2. Gradle构建系统 - 教程

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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