Tomsen1410
Tomsen1410

Reputation: 31

LibGDX - Android Studio cannot resolve symbol

we have to create an android application and we want to animate a 3d model. Therefore, we wanted to use libgdx. So we added these lines to our build.gradle file in android studio:

ext {
    appName = 'bream'
    gdxVersion = '1.3.1'
}

repositories {
    mavenCentral()
    mavenLocal()
    maven { url "https://jitpack.io" }
    maven { url 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/' }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}

dependencies {
    compile 'com.facebook.android:facebook-android-sdk:3.23.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
}

However, it does not find "com.badlogic.gdx.backends.android" and the AndroidApplication class coming with this import. Does anyone know how to fix this?

Thanks in advance!

Upvotes: 0

Views: 1172

Answers (1)

Shafiq al-Shaar
Shafiq al-Shaar

Reputation: 1323

Because you're clearly not loading "com.badlogic.gdx.backends.android". You're loading only the core LibGDX. Here's what it would look like for an Android gradle build.

        compile "com.badlogicgames.gdx:gdx:$gdxVersion"  // core        
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        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-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"

I suggest you to download LibGDX's gradle setup application from their website to understand how the dependencies work together.

Upvotes: 1

Related Questions