Spotify crash on AuthenticationClient.openLoginActivity
Issue found on 10/29/2020
SDK Version:
spotify-app-remote-release-0.7.0.aar spotify-auth-release-1.2.3.aar
OS Version:
7.1.1 Nexus nextbook tablet Model: NX16A10132SPS
Scope(s):
? not sure what you mean by Scope in this context (sorry)
Steps to reproduce:
- register my app in the Spotify console
- have the Spotify App installed
- be logged into Spotify app (free/premium shouldn't matter)
- Trigger authentication against Spotify using Auth SDK
val request = AuthenticationRequest.Builder(
CLIENT_ID,
AuthenticationResponse.Type.TOKEN,
REDIRECT_URI
)
.setScopes(arrayOf("streaming", "playlist-read", "app-remote-control"))
.build()
AuthenticationClient.openLoginActivity(handlerActivity, REQUEST_CODE, request)
Expected behavior:
We are successfully authenticated and get a token back.
Actual behavior:
Spotify crashes with the following juicy error:
2020-10-29 19:00:57.261 17202-17202/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.spotify.music, PID: 17202
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | com.spotify.mobius.rx2.EffectHandlerException: Error in effect handler
at io.reactivex.plugins.a.g(SourceFile:8)
at com.spotify.mobius.rx2.l.j(SourceFile:1)
at com.spotify.mobius.rx2.a.d(lambda)
at io.reactivex.internal.operators.observable.j$a.onError(SourceFile:4)
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.b(SourceFile:14)
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapInnerObserver.onError(SourceFile:8)
at io.reactivex.internal.operators.observable.v$a.onError(SourceFile:1)
at io.reactivex.internal.subscribers.b.onError(SourceFile:4)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.a(SourceFile:5)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.b(SourceFile:8)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.onError(SourceFile:3)
at io.reactivex.internal.operators.flowable.o$a.onError(SourceFile:1)
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.h(SourceFile:3)
at com.spotify.rxjava2.g.d(lambda)
at io.reactivex.internal.observers.LambdaObserver.onError(SourceFile:3)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.b(SourceFile:11)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(SourceFile:18)
at io.reactivex.android.schedulers.b$b.run(SourceFile:1)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)
Caused by: com.spotify.mobius.rx2.EffectHandlerException: Error in effect handler
at zx1.apply(Unknown Source)
at com.spotify.mobius.rx2.a.d(lambda)
at io.reactivex.internal.operators.observable.j$a.onError(SourceFile:4)
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapObserver.b(SourceFile:14)
at io.reactivex.internal.operators.observable.ObservableSwitchMap$SwitchMapInnerObserver.onError(SourceFile:8)
at io.reactivex.internal.operators.observable.v$a.onError(SourceFile:1)
at io.reactivex.internal.subscribers.b.onError(SourceFile:4)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.a(SourceFile:5)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.b(SourceFile:8)
at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.onError(SourceFile:3)
at io.reactivex.internal.operators.flowable.o$a.onError(SourceFile:1)
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.h(SourceFile:3)
at com.spotify.rxjava2.g.d(lambda)
at io.reactivex.internal.observers.LambdaObserver.onError(SourceFile:3)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.b(SourceFile:11)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(SourceFile:18)
at io.reactivex.android.schedulers.b$b.run(SourceFile:1)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:859)
Caused by: java.lang.RuntimeException: Failed binding to the service. Intent: Intent { act=com.spotify.mobile.service.action.COSMOS_PROXY cmp=com.spotify.music/com.spotify.mobile.android.service.SpotifyService }
2020-10-29 19:00:57.261 17202-17202/? E/AndroidRuntime: Registered services: com.spotify.music.storage.CacheMovingIntentService, com.spotify.mobile.android.service.SpotifyService, com.spotify.music.playlist.service.PlaylistService, com.spotify.music.spotlets.radio.service.RadioActionsService, com.spotify.mobile.android.service.media.ExternalIntegrationService, com.spotify.mobile.android.service.feature.FeatureService, com.spotify.music.libs.mediabrowserservice.SpotifyMediaBrowserService, com.spotify.mobile.android.spotlets.appprotocol.service.AppProtocolBluetoothService, com.spotify.mobile.android.spotlets.appprotocol.service.AppProtocolRemoteService, com.spotify.mobile.android.shortcut.ShortcutInstallerService, com.spotify.music.features.queue.service.QueueService, com.spotify.mobile.android.spotlets.bixbyhomecards.BixbyHomeCardService, com.spotify.music.features.quicksilver.utils.QuicksilverLoggerService, com.spotify.music.features.quicksilver.utils.QuicksilverPlaybackService, com.spotify.music.ads.voice.VoiceAdService, com.spotify.music.features.go.service.GoBluetoothService, com.spotify.music.features.spoton.service.SpotOnService, com.spotify.music.marquee.MarqueeService, com.spotify.music.homething.addnewdevice.scandevices.service.HomethingActivationService, com.spotify.music.features.pushnotifications.inapppreference.NotificationPreferenceUpdateService, com.spotify.music.features.reportexplicit.ReportTrackExplicitService, com.spotify.music.sociallistening.service.SocialListeningService, com.spotify.mobile.android.ui.activity.dynamicupsell.DynamicUpsellLoggerService, com.spotify.mobile.android.ui.activity.upsell.TrialActivationService, com.spotify.music.feedback.service.FeedbackService, com.spotify.music.libs.collection.service.OffliningService, com.spotify.music.libs.collection.service.CollectionService, com.spotify.music.libs.collection.played.PlayedStateService, com.spotify.mobile.android.recentlyplayed.RecentlyPlayedService, com.spotify.music.spotlets.radio.formatlist.RadioFormatListService, com.spotify.music.storylines.service.StorylinesUrisFetcher, com.spotify.music.behindthelyrics.service.BehindTheLyricsResourcesAndTracksFetcher, com.spotify.music.emailverify.EmailVerifyDispatcherService, com.spotify.pushnotifications.SpotifyFirebaseMessagingService, com.google.android.gms.cast.framework.media.MediaNotificationService, com.google.android.gms.cast.framework.ReconnectionService, com.google.firebase.components.ComponentDiscoveryService, com.google.firebase.messaging.FirebaseMessagingService, com.google.android.datatransport.runtime.backends.TransportBackendDiscovery, com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService, com.google.android.gms.auth.api.signin.RevocationBoundService, com.google.android.gms.measurement.AppMeasurementService, com.google.android.gms.measurement.AppMeasurementJobService, androidx.work.impl.background.systemjob.SystemJobService, androidx.work.impl.foreground.SystemForegroundService, androidx.room.MultiInstanceInvalidationService
at com.spotify.mobile.android.service.u.a(SourceFile:22)
at com.spotify.rxjava2.j.b(SourceFile:3)
at com.spotify.rxjava2.b.a(lambda)
at io.reactivex.internal.operators.observable.ObservableCreate.K0(SourceFile:3)
at io.reactivex.t.c(SourceFile:4)
at io.reactivex.internal.operators.observable.c0.K0(SourceFile:1)
at io.reactivex.t.c(SourceFile:4)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$a.run(SourceFile:1)
... 8 more
As a result of Spotify failing to connect to my app, the response handler gets back AuthenticationResponse.Type.EMPTY and no other useful information.
This same code works on my GalaxyS7 running Android O (8), and Aoson tablet running Android M (6). I guess I'm just wondering if you might have any idea as to why a foreground service would fail to bind and if there's anything I can about this?
If you think a larger view of the code would be useful, the project I'm working on is also open-source, so you can check out the rest of the code at https://github.com/niehusst/partyq/blob/main/app/src/main/java/com/niehusst/partyq/services/SpotifyAuthenticator.kt