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

Android Studio 3.1依赖解析失败及主题识别异常问题求助

Hey there, let's work through these two annoying issues you ran into after upgrading to Android Studio 3.1. I've seen similar problems before, so here's how to fix them:

1. Fixing "Failed to resolve: com.github.florent37:android-slidr:1.0.4"

This error pops up because the library you're trying to use is hosted on JitPack, and Android Studio might not have access to that repository by default. Here's what to do step by step:

  • First, open your project root directory's build.gradle (not the one inside your app module).
  • In the allprojects > repositories block, add the JitPack repository to let AS find the library:
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' } // Add this line
        }
    }
    
  • Next, update your dependency line in the app module's build.gradle—note that compile is deprecated in Android Studio 3.0+, so switch to implementation instead:
    dependencies {
        implementation 'com.github.florent37:android-slidr:1.0.4'
    }
    
  • Click the Sync Project with Gradle Files button (the elephant icon in the toolbar) to apply changes. If it still fails, go to File > Invalidate Caches / Restart... and select Invalidate and Restart to clear old cached data that might be causing conflicts.
2. Fixing "Cannot resolve symbol 'Theme'" in style files (even though the app runs)

This is almost always an index/cache glitch with Android Studio after an upgrade. The app works because the actual build process is fine—AS just can't locate the Theme symbol in its local index. Try these fixes:

  • First, sync your project again using the elephant icon mentioned earlier. Sometimes a simple sync clears up indexing hiccups.
  • If sync doesn't help, do a full cache reset: go to File > Invalidate Caches / Restart..., choose Invalidate and Restart. This will restart Android Studio and rebuild all its indexes, which usually gets rid of those red squiggles.
  • Double-check your app module's build.gradle to make sure you have the necessary support/AndroidX dependencies. For example, if you're using AndroidX, you should have something like this to ensure Theme classes are recognized:
    dependencies {
        implementation 'androidx.appcompat:appcompat:1.3.0'
    }
    
  • Make sure your style files are in the correct location (res/values/styles.xml or similar) and don't have typos in the file name or structure.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 06:45:27