Android Studio 3.0 无法解析符号主题 [英] Android Studio 3.0 cannot resolve symbol Theme

查看:30
本文介绍了Android Studio 3.0 无法解析符号主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如style.xml中所述,有一个奇怪的错误,显示Cannot resolve symbol 'Theme',很奇怪.

As stated in style.xml, there is a weird error, which shows Cannot resolve symbol 'Theme', which is quite strange.

查看错误图片:-

我的项目规格:-

使用 Android Studio 3.0

Using Android Studio 3.0

和 gradle 3.0.0 版

and gradle version 3.0.0

和 distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

and distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

-

尝试通过转到文件">使缓存无效/重新启动">无效并重新启动"来清除缓存,但无济于事,因为错误仍然存​​在.

Tried clearing the cache by going to File > Invalidate Cache/Restart > Invalidate and Restart, but to no avail, as the error persists.

推荐答案

另一个可能的原因是:未为构建脚本设置 Google 的 maven 存储库.

Another possible reason is: Google's maven repository is not set for the build script.

打开你项目的主 bu​​ild.gradle 添加这一行:

Open your project's main build.gradle add this line:

buildscript {
    repositories {
        google()  <-- this
        // Be also sure that google() is before jcenter()
    }
}

没有这个,它可能无法下载Android Studio Gradle插件3.0+.它不是分布在 jCenter 中,而是分布在 Google 的 maven 存储库中.

Without this, it may not be able to download the Android Studio Gradle plugin 3.0+. It's not distributed in jCenter but in the Google's maven repository.

这篇关于Android Studio 3.0 无法解析符号主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆