【问题标题】:Unable to build libGDX example https://github.com/libgdx/libgdx-demo-invaders out of box无法开箱即用地构建 libGDX 示例 https://github.com/libgdx/libgdx-demo-invaders
【发布时间】:2023-01-08 20:09:25
【问题描述】:

它与 gradle.wrapper 中的 Gradle 6.7.1 一起运行,但失败:

./gradlew --gradle-user-home D:\Java\.gradle core:compileJava
Configuration on demand is an incubating feature.

> Configure project :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.

> Task :core:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':core:compileJava'.
> Could not resolve all files for configuration ':core:compileClasspath'.
   > Could not resolve com.badlogicgames.gdx:gdx:1.11.0.
     Required by:
         project :core
      > No matching variant of com.badlogicgames.gdx:gdx:1.11.0 was found. The consumer was configured to find an API of a library compatible with Java 6, preferably in the form of class files, and its dependencies declared extern
ally but:
          - Variant 'apiElements' capability com.badlogicgames.gdx:gdx:1.11.0 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 7 and the consumer needed a component compatible with Java 6
          - Variant 'javadocElements' capability com.badlogicgames.gdx:gdx:1.11.0 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 6)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
          - Variant 'runtimeElements' capability com.badlogicgames.gdx:gdx:1.11.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 7 and the consumer needed a component compatible with Java 6
          - Variant 'sourcesElements' capability com.badlogicgames.gdx:gdx:1.11.0 declares a runtime of a component, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 6)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)

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

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
1 actionable task: 1 executed

【问题讨论】:

    标签: java gradle libgdx


    【解决方案1】:

    在所有模块中将 sourceCompatibility 更新为 1.8 后错误消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多