android studio中有很多“无法解决符号”的错误

时间:2022-12-04 19:47:47

I built my project from Build > Rebuild Project and suddenly I got a lot of 'cannot resolve symbol' errors, and lot of text went 'red' and building the project gave errors as follows:

我从Build> Rebuild Project构建了我的项目,突然间我收到了很多“无法解决符号”的错误,很多文本都变成了“红色”,构建项目时出现了如下错误:

    Information:Gradle tasks [clean, :generateDebugSources, :generateDebugAndroidTestSources, :app:generateDebugSources, :app:generateDebugAndroidTestSources]
:clean
:app:clean UP-TO-DATE
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
C:\Users\HP\AndroidstudioProjects\JtEventsAndAnnouncements.BAK3\build\intermediates\manifests\full\debug\AndroidManifest.xml
Error:(16, 23) No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
Error:(17, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(18, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(21, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Program Files\Android\sdk\build-tools\21.0.1\aapt.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 16.514 secs
Information:5 errors
Information:0 warnings
Information:See complete output in console

This is my styles.xml:

这是我的styles.xml:

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>

styles-v11:

<resources>

    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <!-- API 11 theme customizations can go here. -->
    </style>

</resources>

styles-v14:

    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
        <!-- API 14 theme customizations can go here. -->
    </style>

</resources>

My layout design tab for one fragment shows the following error:

我的一个片段的布局设计选项卡显示以下错误:

 Rendering Problems NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first.  The following classes could not be found:
- android.support.v4.widget.SwipeRefreshLayout (Fix Build Path, Edit XML, Create Class)
 Tip: Try to build the project.

Does anyone have an idea as to what might be going on?

有没有人知道可能会发生什么?

Update:

Here's my build.gradle:

这是我的build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply plugin: 'android'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

android {
    buildTypes {
        debug {
            debuggable true
        }
    }


    compileSdkVersion 21
    buildToolsVersion "21.0.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 21
    }

}

1 个解决方案

#1


Update your XML :

更新您的XML:

    <resources>
    <style name="AppBaseTheme"  parent="@android:style/Theme.Holo.Light">
    </style>

    <style name="AppTheme" parent="android:Theme.Holo.Light">
   </style>
 <resources>

Then Rebuild & Restart

然后重建并重启

#1


Update your XML :

更新您的XML:

    <resources>
    <style name="AppBaseTheme"  parent="@android:style/Theme.Holo.Light">
    </style>

    <style name="AppTheme" parent="android:Theme.Holo.Light">
   </style>
 <resources>

Then Rebuild & Restart

然后重建并重启