将Spotify的Android SDK导入Android Studio

时间:2016-10-23 05:13:23

标签: android import sdk spotify

我目前正尝试在Android Studio上使用Spotify的SDK制作应用,但是当我从本指南中复制其代码时:https://developer.spotify.com/technologies/spotify-android-sdk/tutorial/

我在这里遇到以下错误:

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
{

他们无法解决“错误”,“PlayerEvent”或“SpotifyPlayer”之类的问题。

我已将.aar文件添加到正确的位置(app / libs)并对gradle进行了更改(运行时没有错误)但除此之外,我不确定我做错了什么。< / p>

这是我的构建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'
}

1 个答案:

答案 0 :(得分:0)

我认为也许是重点吗?

enter image description here

发现某些教程/指南仍未更新,因此无论如何,如果我回答错误,我建议未来的读者始终检查这些库的变更日志