无法解析符号Theme.MaterialComponents.Light.NoActionBar(Android Studio) [英] Cannot resolve symbol Theme.MaterialComponents.Light.NoActionBar (Android Studio)

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

问题描述

在几次Gradle更新后,'Theme.MaterialComponents.Light.NoActionBar'中的'Theme.MaterialComponents.Light.NoActionBar'出现错误(由于错误,'Theme.MaterialComponents.Light.NoActionBar'显示为红色)。我的组件也没有按照我的设计理念很好地排列。

我已经清理和重建项目、使缓存失效/重新启动、更新Gradle(可能不是正确的答案),但对此没有答案。我只是在想,也许我是唯一一个有这个问题的人,可能是因为我的初学者水平:‘)

style es.xml

`

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/hitam</item>
    <item name="colorAccent">@color/colorAccent</item>

</style>

`

项目成绩

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.2'
    classpath 'com.google.gms:google-services:4.2.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

App Gradle

      apply plugin: 'com.android.application'
      apply plugin: 'com.google.gms.google-services'

      android {
          compileSdkVersion 29
          defaultConfig {
          applicationId "blablabla"
          minSdkVersion 23
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner               "androidx.test.runner.AndroidJUnitRunner"

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '29.0.1'
}

compileOptions {

    sourceCompatibility JavaVersion.VERSION_1_6
    targetCompatibility JavaVersion.VERSION_1_6

    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7

    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.10.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
}

apply plugin: 'com.google.gms.google-services'
buildToolsVersion = '29.0.1'

          }

`

我认为当地球上没有人有这个错误时,这个错误是看不到的。请帮帮T_T

推荐答案

Material Components themes包含在Material Components for Android library中。

因为您使用的是androidx库,所以只需在app/build.gradle文件中添加此依赖项。

dependencies {
    // ...
    implementation 'com.google.android.material:material:x.x.x'
    // ...
  }

目前最新稳定版本为

implementation 'com.google.android.material:material:1.1.0'

您可以在此处找到所有信息the setup

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

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