为什么我们在 Logcat 中看到 Spotify 登录?
Why do we see Spotify logs in Logcat?
我正在开发自己的 Android 应用程序,奇怪的是,我在 Logcat.
中看到一些与 Spotify 相关的日志
为什么是这样 ?这是否意味着应用程序的日志可以很容易拦截?我们可以阻止这种情况发生吗?
编辑
好的。我试图重新测试几次。它似乎与我的应用程序无关。但是,每次我将 USB 数据线插入智能手机时,都会出现许多 Spotify 日志(主要是警告和错误)。
以下是一些示例:
E/Spotify: [RxCachedThreadScheduler-1] Could not retrieve access token for a webgate request: POST https://spclient.wg.spotify.com/gabo-receiver-service/v2/events
E/Spotify: [RxCachedThreadScheduler-1] sp://webgate/v1/token responded with an error: 39, ap_network_disabled
E/Spotify: [OkHttp https://spclient.wg.spotify.com/...] sp://webgate/v1/token responded with an error: 39, ap_network_disabled
E/Spotify: [OkHttp https://spclient.wg.spotify.com/...] Could not retrieve access token for a webgate request: GET https://spclient.wg.spotify.com/quicksilver/v2/triggers
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.service.SpotifyService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.storylines.service.StorylinesFetcher
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.spotlets.ads.marquee.MarqueeService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.service.feature.FeatureService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.features.podcast.episode.experiment.EpisodeMetadataFetcher
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.behindthelyrics.service.BehindTheLyricsResourcesAndTracksFetcher
如果这对您的应用来说是个问题,并且您愿意在生产环境中剥离应用的日志,您可以使用 Proguard(例如)(https://medium.com/@trionkidnapper/stripping-log-statements-using-proguard-73dedc68ee97)
大多数商业混淆器也支持剥离日志。
正如@DevMike01 所说,您可能应该更改 logcat 以仅显示您的应用程序的日志:
发生这种情况的原因可能是因为您已连接到自己的设备并且正在查看自己设备的所有日志和事件,而不仅仅是您自己的应用程序
您可以通过单击下拉菜单(示例中为红色并选择您的应用)来执行此操作
另外,在生产环境中登录是个坏主意,因为这也是一个示例,如果您愿意,您可能会考虑使用 Timber 作为普通日志的替代品(这是一个非常标准的日志记录现在 android 的实用程序 https://github.com/JakeWharton/timber)
我正在开发自己的 Android 应用程序,奇怪的是,我在 Logcat.
中看到一些与 Spotify 相关的日志
为什么是这样 ?这是否意味着应用程序的日志可以很容易拦截?我们可以阻止这种情况发生吗?
编辑
好的。我试图重新测试几次。它似乎与我的应用程序无关。但是,每次我将 USB 数据线插入智能手机时,都会出现许多 Spotify 日志(主要是警告和错误)。
以下是一些示例:
E/Spotify: [RxCachedThreadScheduler-1] Could not retrieve access token for a webgate request: POST https://spclient.wg.spotify.com/gabo-receiver-service/v2/events
E/Spotify: [RxCachedThreadScheduler-1] sp://webgate/v1/token responded with an error: 39, ap_network_disabled
E/Spotify: [OkHttp https://spclient.wg.spotify.com/...] sp://webgate/v1/token responded with an error: 39, ap_network_disabled
E/Spotify: [OkHttp https://spclient.wg.spotify.com/...] Could not retrieve access token for a webgate request: GET https://spclient.wg.spotify.com/quicksilver/v2/triggers
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.service.SpotifyService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.storylines.service.StorylinesFetcher
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.spotlets.ads.marquee.MarqueeService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.mobile.android.service.feature.FeatureService
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.features.podcast.episode.experiment.EpisodeMetadataFetcher
W/ProcStatsManager: No process com.spotify.music/10128 for service com.spotify.music.behindthelyrics.service.BehindTheLyricsResourcesAndTracksFetcher
如果这对您的应用来说是个问题,并且您愿意在生产环境中剥离应用的日志,您可以使用 Proguard(例如)(https://medium.com/@trionkidnapper/stripping-log-statements-using-proguard-73dedc68ee97)
大多数商业混淆器也支持剥离日志。
正如@DevMike01 所说,您可能应该更改 logcat 以仅显示您的应用程序的日志:
发生这种情况的原因可能是因为您已连接到自己的设备并且正在查看自己设备的所有日志和事件,而不仅仅是您自己的应用程序
您可以通过单击下拉菜单(示例中为红色并选择您的应用)来执行此操作
另外,在生产环境中登录是个坏主意,因为这也是一个示例,如果您愿意,您可能会考虑使用 Timber 作为普通日志的替代品(这是一个非常标准的日志记录现在 android 的实用程序 https://github.com/JakeWharton/timber)