You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Gradle已添加依赖仍无法导入Spotify类的问题求助

解决Spotify Auth类无法导入的问题
  • 升级Spotify Auth依赖版本
    你当前使用的com.spotify.android:auth:1.1.0版本较旧,部分类可能已被调整或迁移。建议替换为最新稳定版本(比如2.1.0),修改后的依赖行:

    implementation ("com.spotify.android:auth:2.1.0")
    
  • 执行Gradle同步与缓存清理

    1. 点击Android Studio右上角的「Sync Project with Gradle Files」按钮,确保依赖同步完成
    2. 若同步后仍无法导入,执行「File → Invalidate Caches... → Invalidate and Restart」清理缓存并重启IDE
  • 确认类的正确引用
    检查导入语句是否正确,在新版Auth SDK中,你需要的类正确的导入路径应为:

    import com.spotify.sdk.android.auth.AuthorizationResponse
    import com.spotify.sdk.android.auth.SpotifyConstants
    import com.spotify.sdk.android.auth.SpotifyAuthorization
    

    若升级后类名或包路径有变更,可通过Android Studio的「Find in Path」功能搜索类名确认位置。

  • 移除重复依赖
    你的Gradle配置中重复添加了com.google.android.gms:play-services-auth:20.7.0,建议删除其中一行,避免潜在的依赖冲突

内容的提问来源于stack exchange,提问作者Vitor Rodrigues

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 14:02:06