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

android studio中的生成错误

尹英华
2023-03-14

我的 gradle 文件像这样

apply plugin: 'com.android.application'

 android {
   compileSdkVersion 19
   buildToolsVersion "19.1.0"

defaultConfig {
    applicationId "com.test.app"
    minSdkVersion 19
    targetSdkVersion 19

    ndk {
        moduleName "opus"
    }
}

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

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.code.gson:gson:2.2.4'

}

我在构建过程中遇到以下错误

<path to project>/app/build/intermediates/res/merged/debug/values-v21/values-v21.xml

Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(209) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(211) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(214) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'.
Error:(231) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.
Error:(177) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(9) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(6) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(7) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(8) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(10) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(11) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(12) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'.
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'.
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'.
Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'.
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:(36) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(38) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(40) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(42) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(44) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(46) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(48) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(50) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(52) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'.
Error:(54) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(56) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(166) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(168) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(170) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(172) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(178) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'.
Error:(179) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'.
Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'.
Error:(181) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'.
Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'.
Error:(183) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'.
Error:(184) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'.
Error:(185) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(186) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(188) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(190) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(192) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(198) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(200) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(201) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(203) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(213) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'.
Error:(215) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(220) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.
Error:(221) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'.
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
<path to app>/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values-v21/values-v21.xml
Error:(77, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(77, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(126, 5) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(129, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(178, 5) No resource found that matches the given name: attr 'android:windowElevation'.
Error:(211, 5) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(222, 5) No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(257, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorAccent'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorControlActivated'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorControlNormal'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorPrimary'.
Error:(267, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 1

我该如何解决这个问题

共有2个答案

柴深
2023-03-14
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.

将编译sdk版本设置为21

 compileSdkVersion 21
 buildToolsVersion '23.0.0'

并呼叫

compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:6.5.87'

然后单击应用-

不要调用<code>编译'com.android.support:support-v4:19.1.0'

阅读材料主题设置

AppCompat v7 r21是否在values.xml中返回错误?

双志强
2023-03-14

因为您正在使用:

 compile 'com.google.android.gms:play-services:+'

您正在添加最新版本,该版本具有以下依赖项:

 <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-v4</artifactId>
      <version>22.2.0</version>
      <scope>compile</scope>
      <type>aar</type>
    </dependency>
  </dependencies>

可以查看GMS \ play-services-basement \ 8 . 3 . 0 POM文件。

它需要API 22来编译项目,然后更改:

compileSdkVersion 22

我也建议你使用最新的api 23

   compileSdkVersion 23
   buildToolsVersion "23.0.1"

并且不要在依赖项中使用

 类似资料:
  • 我创建了一个简单的. proto文件并执行了编译器(protoc-2.5.0rc1-win32.zip)。为规定的包生成了一个java文件。但是,生成的文件不会编译。. proto文件很简单,只有一条消息,其中包含一堆简单类型的可选字段(正确编号)。. java文件不编译,例如: 构造函数生成了消息。FieldAccessorTable(Descriptors.Descriptor,字符串[])未

  • 我试图从源代码构建CAS服务器,并按url构建过程一步一步地运行 我在步骤构建中得到这个错误: 编译器(1.8.0_66)中发生异常。在检查数据库中是否有重复项后,请在Java bug数据库(http://bugreport.Java.com/bugreport/)中提交一个bug。在报告中包括程序和以下诊断。谢谢你。 任务:api:cas-server-core-api-webflow:comp

  • 我有以下代码片段 我尝试运行应用程序时出现以下错误(部分) 似乎type="num "没有被处理。我怀疑年龄int也可能是一个问题,因为它是一个int,但需要一个string。从sting到int的反向转换也可能是一个问题。 任何帮助是值得赞赏的。 谢谢

  • 我在eclipse Luna中使用JAXB从第三方XSD文件生成Java类。这个文件通常定义一个简单类型,它只是一个原始类型。例如: 然后将简单类型用于复杂类型的元素,例如: JAXB为复杂类型生成一个看起来完全正确的Java类: 但是,它还为@XmlElement(name="ChannelId")行生成以下JAXB错误 有人知道这个错误消息是什么意思吗?我不能更改XSD文件,但是应该怎么做来删

  • 我运行的是Mac OSX,我安装了android Studio-它启动正常。 问题1 我用一个空活动开始一个新项目。在最上面的窗户上我收到一条信息 问题2 我在底部窗口中看到以下错误: 错误:CompilesDKVersion android-L需要使用JDK 7 Open SDK Settings进行编译 打开文件 当我尝试在设备上运行项目时,我得到以下错误: 失败[INSTALL_FAILED

  • 我试图在codenameone中构建一个示例,当我试图生成ios构建时,我在codenameone构建服务器下的构建中得到了像"构建错误"这样的错误。 这是我得到的错误日志 如果有人对此有想法,请帮助我... 对不起,我的英语很差。。 提前谢谢。。