Spotify requires SHA1 debugging during development. After you have released your application, you need to add the SHA1 release for your application along with the name of your package, as shown in AndroidManifest. Add this via the Spotify Dashboard for your app in the Android Packages section.
To find out SHA1 for released APKs, you first need to create a signed APK from Android Studio.
Then, be sure to add the following to your build.gradle application:
android { //... signingConfigs { release { storeFile file('KEY_STORE_PATH_FOR_YOUR_APK') storePassword 'YOUR_PW' keyAlias 'YOUR_KEY_ALIAS' keyPassword 'YOUR_KEY_PW' } } buildTypes { //... release { signingConfig signingConfigs.release } } //... }
This will allow you to print the release and debug SHA1 in Logcat. In Android Studio, open the Gradle terminal and set signingReport as the signingReport command line. Click OK and the value will be printed.
Why is this needed?
When the user has already installed the Spotify application and is already logged in, there is no need to log in again for your application. This will be done automatically in the background using OAuth which requires SHA1. If Spotify is not installed, SHA1 is not required, and instead, the user is prompted to log into your application. However, if the user has the Spotify application installed, there is no way to show the login prompt in your application ... therefore, the login will fail if SHA1 is not available.
Datasun
source share