Announcements

Help Wizard

Step 1

NEXT STEP

Getting Started with Andrdoid SDK Deprecated?

Solved!

Getting Started with Andrdoid SDK Deprecated?

Working with Android Studio 2022.2.1 Patch 2

Kotlin 2.1.6

 

I'm trying to add Spotify SDK to my Android App using this tutorial but it seems like it's old/deprecated and I'm getting errors no matter what I do. 

 

First off I don't think adding a JAR/AAR as a module is supported in Android Studio anymore (at least not the way it's done in the tutorial) so what exactly is the module structure supposed to look like for spotify-app-remote? I ended up creating a spotify-app-remote module in the root directory and including the .aar file in the libs folder, and added these lines to app/build.gradle like the tutorial says:

implementation project(':spotify-app-remote')
implementation "com.google.code.gson:gson:2.6.1"

but I don't know if this is correct because I can't get past this step.

 

The next step has us import all this 

import com.spotify.android.appremote.api.ConnectionParams;
import com.spotify.android.appremote.api.Connector;
import com.spotify.android.appremote.api.SpotifyAppRemote;

import com.spotify.protocol.client.Subscription;
import com.spotify.protocol.types.PlayerState;
import com.spotify.protocol.types.Track;

but I'm getting a module spotify not found error. I tried changing spotify to spotify_app_remote (the package name uses _ instead of -) but I get the same module not found error. 

 

I also tried adding imports in app/build.gradle like this 

implementation "com.spotify.android:auth:2.0.0"
implementation 'com.spotify.android.appremote:spotify-app-remote:1.2.0'
implementation 'com.spotify.protocol:spotify-protocol:0.7.2'

The first one gets rid of module spotify not found but then protocol and android are unrecognized. The last two lines break the build because I'm unable to find the correct version numbers anywhere. 

 

I feel like I'm beating my head against a wall here, it would be super helpful if someone could walk me through the tutorial with a more updated version of Kotlin/android studio.  
 

Reply

Accepted Solutions
Marked as solution

Hi i tried to use it today , I have tried couple of things it is now working for me.

Here is what I did

Download the spotify-app-remote-release-0.7.2.aar file from github

Put it in app(your main module name)/libs folder

On Android Studio go Project Structure -> Dependencies

Select app module and add a jar/aar dependency

On the pop up menu put write libs to folder name

 

It should add following line to your module level build.gradle

implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])

Add gson aswell with following line

implementation 'com.google.code.gson:gson:2.10.1'

 

Then the tutorial code should work.

Have a nice day !

View solution in original post

2 Replies
Marked as solution

Hi i tried to use it today , I have tried couple of things it is now working for me.

Here is what I did

Download the spotify-app-remote-release-0.7.2.aar file from github

Put it in app(your main module name)/libs folder

On Android Studio go Project Structure -> Dependencies

Select app module and add a jar/aar dependency

On the pop up menu put write libs to folder name

 

It should add following line to your module level build.gradle

implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])

Add gson aswell with following line

implementation 'com.google.code.gson:gson:2.10.1'

 

Then the tutorial code should work.

Have a nice day !

Thanks so much!! That fixed it

Suggested posts