Home > Mobile >  Unable to build libGDX example https://github.com/libgdx/libgdx-demo-invaders out of box
Unable to build libGDX example https://github.com/libgdx/libgdx-demo-invaders out of box

Time:01-12

It is running with Gradle 6.7.1 from gradle.wrapper and fails with:

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

CodePudding user response:

The error has gone after updating sourceCompatibility to 1.8 in all modules.

  • Related