Question

I downloaded the new libgdx-setup and every time I generate a project with box2dlights it fails and I can't import it because it keeps giving me an error about not finding box2dlights. I also had an issue with the older gdx-setup-ui where I couldn't access third party libraries so I am getting frustrated with libgdx.

* What went wrong:
A problem occurred configuring project ':android'.
> Could not resolve all dependencies for configuration ':android:_debugCompile'.
   > Could not find com.badlogicgames.box2dlights:box2dlights:1.2.
     Required by:
         test:android:1.0
         test:android:1.0 > test:core:1.0

When I generate a project with no dependencies checked I can import it fine into eclipse, but I want to be able to select box2dlights as I am going to be using it. I can see box2dlights in my build.gradle so from what I have gathered, it should automatically download. Here is my build.gradle

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9+'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'my-gdx-game'
        gdxVersion = '1.0.0'
        roboVMVersion = '0.0.11'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }
}

project(":desktop") {
    apply plugin: "java"


    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"

        compile "com.badlogicgames.box2dlights:box2dlights:1.1"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"

        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
    }
}

project(":core") {
    apply plugin: "java"


    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.box2dlights:box2dlights:1.2"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    }
}

tasks.eclipse.doLast {
    delete ".project"
}

I can see compile "com.badlogicgames.box2dlights:box2dlights:1.1", which according to the github docs is all I need, plus I didn't change any settings so everything by default should work shouldn't it?

Was it helpful?

Solution

I believe the 1.2 is a typo.. I'm not aware of box2D lights have a version 1.2 as of yet, unless it's coming and they pre-emptively had it put in ahead of schedule to be called instead of v1.1.

For my eclipse build, I was able to compile it after changing all references of 1.2 to 1.1, and my gradle built just fine.

The setup worked even though I got those errors when using the gdx ui provided for the gradle build.

(at the very bottom of your gradle file, I noticed in the :core area, you still have a reference to boxlights 1.2, which you should change to 1.1)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top