1

I am currently trying to make an app using Spotify's SDK on Android Studio, but when I have copied their code from this guide: https://developer.spotify.com/technologies/spotify-android-sdk/tutorial/

I get the following errors here:

import com.spotify.sdk.android.authentication.AuthenticationClient;
import com.spotify.sdk.android.authentication.AuthenticationRequest;
import com.spotify.sdk.android.authentication.AuthenticationResponse;
import com.spotify.sdk.android.player.Config;
import com.spotify.sdk.android.player.ConnectionStateCallback;
import com.spotify.sdk.android.player.Error;
import com.spotify.sdk.android.player.Player;
import com.spotify.sdk.android.player.PlayerEvent;
import com.spotify.sdk.android.player.Spotify;
import com.spotify.sdk.android.player.SpotifyPlayer;

public class MainActivity extends AppCompatActivity implements
        SpotifyPlayer.NotificationCallback, ConnectionStateCallback
{

Where they cannot resolve the stuff like "Error", "PlayerEvent", or "SpotifyPlayer".

I have added the .aar files to the proper location (app/libs) and made changes to the gradle (no errors when I run it) but other than that, I am not exactly sure what I am doing wrong.

This is my build gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "" +
                ""
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // This library handles authentication and authorization
    compile(name: 'spotify-auth-1.0.0-beta13', ext: 'aar')

    // This library handles music playback
    compile(name: 'spotify-player-1.0.0-beta13', ext: 'aar')

    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
}
asdasda
  • 21
  • 1
  • 9
  • which version are you using? Can you post the build.gradle file? – zon7 Oct 24 '16 at 18:45
  • @zon7 there you go – asdasda Oct 25 '16 at 01:04
  • Ok, they have rolled out version 23, you are using an old old version. Check their latest code example and update your gradle with this lines compile 'com.spotify.sdk:spotify-auth:beta23-noconnect-2.20b@aar' compile 'com.spotify.sdk:spotify-player:beta23-noconnect-2.20b@aar' – zon7 Oct 25 '16 at 15:10
  • I have the exact same problem, were you able to find a solution? – LeleMarieC Dec 18 '16 at 18:35

1 Answers1

0

I think maybe this is the point?

enter image description here

Found that some tutorial/guides still are not updated, so anyway if this is a wrong answer I advise future readers to always check for changelog of these libraries

Tunarock
  • 127
  • 1
  • 1
  • 12