当前位置: 首页 > 知识库问答 >
问题:

使用support-v4和appcompat-v7时出错[重复]

裴欣然
2023-03-14

这些是我在build.gradle中的依赖项

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/jdom-2.0.6.jar')

}

如果我重建项目,我得到这个错误。

Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(121, 22) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(125, 22) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(123, 22) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(124, 22) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(122, 22) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(119, 22) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(120, 22) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(128, 22) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(121, 22) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(125, 22) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(123, 22) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(124, 22) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(122, 22) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(119, 22) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(120, 22) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(128, 22) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(215, 22) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(215, 22) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:(121, 22) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(125, 22) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(123, 22) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(124, 22) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(122, 22) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(119, 22) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(120, 22) No resource found that matches the given name: attr 'android:colorPrimaryDark'.

到底是什么问题?我想使用appcompat-v7,因为我实现了导航抽屉。

我能做什么来解决这个问题。

编辑:

我编辑我的gradle如下:

compileSdkVersion 21
buildToolsVersion "21.1.2"

但是我得到了一些其他的错误:

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values-v23\values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

这是我完整的gradle文件:

    android {
    compileSdkVersion 23
    buildToolsVersion "23.1.1"

    defaultConfig {
        applicationId "de.example.example.app"
        minSdkVersion 17
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    repositories{
        mavenCentral()
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile files('libs/jdom-2.0.6.jar')
}

共有1个答案

燕正卿
2023-03-14

不要同时使用这两个库:v4和v7都使用

只需切换到唯一更好的最新库,即:

compile 'com.android.support:appcompat-v7:23.1.1'

v7包含v4支持库,因此无需再次将其放入其中

尝试添加此选项

 compile 'com.android.support:design:23.0.1'

这是你的身材。gradle文件可能有问题,如compleSdkVersion或buildToolsVersion。

因此,当您使用支持和设计v23时,必须根据SDK 23进行编译。

compileSdkVersion 23
buildToolsVersion '23.1.1'

如果您可能没有sdk更新,请尝试检查23.0.1而不是23.1.1,尝试利用。

最后发布后你 build.gradle 我发现你更改了 targetSdkVersion 23,也清理,重建项目,如果可能的话,尝试重新启动。谢谢

 类似资料:
  • 我试图将各种依赖项添加到android maven项目中,特别是从文件中添加: 我一直在尝试遵循这里的说明,它告诉您使用: 但我得到了一个错误: 这是我完整的pom:

  • 我刚刚在android studio中创建了一个新项目,但它立即抛出了以下指向v23/values-v23.xml文件的错误。1 1。错误:检索项的父项时出错:找不到与给定名称“Android:TextPapearance.Material.Widget.Button.Inverse”匹配的资源。2.错误:检索项目的父项时出错:找不到与给定名称'Android:Widget.Material.Bu

  • 我正在尝试将appcompat-v7添加到我的projct中,但是当我运行gradle同步时会抛出以下错误: /path/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/res/values/values.xml Error:(2) 属性“layout”已被定义 这是我的build.gradl

  • 我有一个React Native应用程序,我试图部署到Windows 10上的Android Studio的Android模拟器。 我在一个高架的Power Shell上运行这个应用程序,使用 Metro Bundler控制台打开,但生成失败,并显示以下消息: 无法解析配置的所有文件: react-nourn-dio: dedegCompileClasspath。 找不到com。Android支持

  • 作为Android开发人员的新手,我遵循最简单的教程,构建了一个新的Android项目,接受所有默认设置(为kitkat构建)。令我沮丧的是,我有一个未计划的项目-<code>appcompat_v7</code>以及错误: 容器'Android依赖项'引用不存在的库'C:\User…\workspace\appcompat_v7\bin\appcompat_v7.jar' 以及下面的两倍 在解决