Java “如何修复”;无法解析符号';app&x27&引用;在安卓工作室?

Java “如何修复”;无法解析符号';app&x27&引用;在安卓工作室?,java,android,android-appcompat,Java,Android,Android Appcompat,Android studio在与支持库相关的每一行上都显示错误。关于重建项目,它说: Android资源链接失败 我试过以下几点: 清理/重建 侵入缓存/重新启动 卸载/重新安装Android Studio 我的build.gradle(应用程序)如下所示: apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "c

Android studio在与支持库相关的每一行上都显示错误。关于重建项目,它说:

Android资源链接失败

我试过以下几点:

  • 清理/重建

  • 侵入缓存/重新启动

  • 卸载/重新安装Android Studio

  • 我的build.gradle(应用程序)如下所示:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.androphobia.fyp.spreadknowledge"
            minSdkVersion 15
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        buildToolsVersion '28.0.3'
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:design:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.google.firebase:firebase-auth:16.1.0'
        implementation 'com.google.firebase:firebase-core:16.0.7'
        implementation 'com.google.firebase:firebase-storage:16.1.0'
        implementation 'com.google.firebase:firebase-firestore:18.0.1'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'de.hdodenhof:circleimageview:3.0.0'
        implementation 'com.google.android.gms:play-services-location:16.0.0'
        implementation 'com.github.bumptech.glide:glide:4.9.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support:support-media-compat:28.0.0'
        implementation 'com.android.support:support-v4:28.0.0'
        implementation 'com.android.support:support-compat:28.0.0'
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    <resources>
    
        <!-- Base application theme. -->
    
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    
        <style name="AppTheme.NoActionBar">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
            <item name="colorAccent">@color/white</item>
        </style>
    
        <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    
        <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
    
    </resources>
    
    styles.xml如下所示:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.androphobia.fyp.spreadknowledge"
            minSdkVersion 15
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        buildToolsVersion '28.0.3'
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:design:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.google.firebase:firebase-auth:16.1.0'
        implementation 'com.google.firebase:firebase-core:16.0.7'
        implementation 'com.google.firebase:firebase-storage:16.1.0'
        implementation 'com.google.firebase:firebase-firestore:18.0.1'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'de.hdodenhof:circleimageview:3.0.0'
        implementation 'com.google.android.gms:play-services-location:16.0.0'
        implementation 'com.github.bumptech.glide:glide:4.9.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support:support-media-compat:28.0.0'
        implementation 'com.android.support:support-v4:28.0.0'
        implementation 'com.android.support:support-compat:28.0.0'
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    <resources>
    
        <!-- Base application theme. -->
    
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    
        <style name="AppTheme.NoActionBar">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
            <item name="colorAccent">@color/white</item>
        </style>
    
        <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    
        <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
    
    </resources>
    
    
    @颜色/原色
    @颜色/原色暗
    @颜色/颜色重音
    假的
    真的
    @颜色/白色
    
    项目中styles.xml的图像如下所示:

    重建项目的结果图像:

    请尝试在此处添加此依赖项:

     implementation "com.android.support:support-core-utils:28.0.0"
    

    请尝试在此处添加此依赖项:

     implementation "com.android.support:support-core-utils:28.0.0"
    

    删除这两个依赖项

    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-compat:28.0.0'
    

    删除这两个依赖项

    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-compat:28.0.0'
    

    降级到27并检查,或检查sdk 28是否安装

    降级到27并检查,或检查sdk 28是否安装

    迁移到Android-X解决了问题

    转到:


    重构-->迁移到AndroidX迁移到Android-X解决了这个问题

    1. Close the Android Studio 
    2. Delete the .AndroidStudio3.3 folder from File System
    3. start Android Studio after that .AndroidStudio3.3 Folder Recreated Automaticall then 
       Your Error will be solved
    
    转到:

    重构-->迁移到AndroidX与问题相关的版本和您的项目

    1. Close the Android Studio 
    2. Delete the .AndroidStudio3.3 folder from File System
    3. start Android Studio after that .AndroidStudio3.3 Folder Recreated Automaticall then 
       Your Error will be solved
    
    在您的项目中,您的支持库版本为28.0.0(androidx之前的版本)和运行androidx版本的CircleImageView

    因此,您必须升级您的项目androidx将circleImageView版本降级为
    2.x

    与问题相关的版本和您的项目

    在您的项目中,您的支持库版本为28.0.0(androidx之前的版本)和运行androidx版本的CircleImageView


    因此,您必须升级项目androidx将circleImageView版本降级为
    2.x

    文件>使缓存无效/重新启动


    为我工作。

    文件>使缓存无效/重新启动


    为我工作。

    将错误代码添加为文本而非图像可能重复@Basi感谢您的回复我添加了图像,因为在代码中不可能显示android studio在重建项目时显示的错误。@GovindParashar我已经阅读了该答案,但遗憾的是没有为其工作me@RanaHamzaKhursheed检查是否得到生成错误日志以文本形式添加错误代码不可能重复@Basi感谢您的回复我添加了该图像,因为在代码中不可能显示android studio在重建项目时显示的错误。@GovindParashar我已经阅读了该答案,但不幸的是,该答案不适用于me@RanaHamzaKhursheed检查是否获得构建错误日志你能传递问题中的样式代码吗?也可以尝试此链接现在检查问题类型
    parent=“android:Theme.Light”
    这而不是您的代码替换为parent=“android:Theme.Light”仅删除特定行上的错误,因为我认为错误是由于appcompat库引起的。请传递问题中的样式代码好吗?请尝试此链接现在检查问题类型
    parent=“android:Theme.Light”
    这而不是您的代码替换为parent=“android:Theme.Light”仅删除特定行上的错误,因为我认为错误是由于appcompat库造成的。问题已解决,感谢您的贡献。我升级到AndroidX.Yoo bro!!坚持下去,问题解决了,谢谢你们的贡献。我升级到AndroidX.Yoo bro!!坚持下去。