简体   繁体   中英

Libgdx gradle project fail to compile

I was adding some codes to my project and it was working fine, until I run it again and gives me this error message:

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'.

I'm pretty sure I'm getting the error not because of my newly added codes because I commented it all out.

error: package com.sun.xml.internal.bind.v2.runtime.reflect.opt does not exist

From your error, following jar is missing. So add this jar to your dependencies . Hope it will solve your issue.

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

UPDATE1:

In your project, you will get build.gradle file. Open it and there will be a portion named dependencies. You have to add the line in dependencies.

if previous condition is like below:

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

After adding this jar file it will look like below

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
}

Resource Location:

For learning more about gradle, you can go through these following tutorial:

  1. Using the Gradle build system in the Eclipse IDE - Tutorial
  2. The Gradle build system- Tutorial

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