【问题标题】:values-v23.xml error.Error retrieving parent for itemvalues-v23.xml 错误。检索项目的父项时出错
【发布时间】:2016-07-23 13:05:12
【问题描述】:

我在 values-v23.xml 中收到这些错误:

错误:(3) 检索项目的父项时出错:未找到与给定名称“android:TextAppearance.Material.Widget.Button.Inverse”匹配的资源。 错误:(18) 检索项目的父项时出错:未找到与给定名称“android:Widget.Material.Button.Colored”匹配的资源。

我的 build.gradle:

    apply plugin: 'com.android.application'

  android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "example.transportmanagement"
    minSdkVersion 17
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
  }

   dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:8.4.0'
   }

我想在 API 21 编译。我阅读了很多问题,但被告知将 sdkversion 更改为 23。如何使用 API 21 解决此错误

清单.xml

        <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.transportmanagement"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/im4"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name="example.transportmanagement.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.SignUp"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.SignUp" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.Login"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.Login" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.SelectAddress"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.SelectAddress" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.Driver"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.Driver" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.FindBus"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.FindBus" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="example.transportmanagement.MapsActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.MapsActivity" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name="example.transportmanagement.DriverMaps"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.example.transportmanagement.DriverMaps" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>


        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />


    </application>

        </manifest>

【问题讨论】:

标签: android xml


【解决方案1】:

如果您想针对 API 21 进行编译,为什么您的项目中有一个文件值 v23?

如果您使用 Valuev 23 android studio,请了解您需要 API 23 应用程序。

因此请尝试删除此文件或将其重命名为 v21。它应该工作

【讨论】:

  • 从 AndroidStudioProjects\TransportManagement\app\build\intermediates\res\merged\ 中删除了值 v23.xml 文件...但是当我重建项目时,它再次生成并显示相同的错误。
  • 可以添加AndroidManifest和Android Studio配置构建的图片吗?
  • 我已添加我的清单详细信息。你告诉分享配置图片。我无法理解。如何获取配置的详细信息,以便我可以与您分享。对此,我对所有这些都不太了解。 :(
【解决方案2】:

您可以使用 SDK 和构建工具 23 进行编译,并且仍然可以在 API 17..21 上定位和运行代码

【讨论】:

  • 是否有任何其他替代方法可以让我在 21 自己编译。
  • 您能解释一下为什么要这样做吗?
  • 如果我在 23 编译并以 21 为目标,我是否也需要处理运行时权限?正如 23 所要求的那样。问起来可能很愚蠢,但我对此比较陌生。提前致谢
  • 不,您只会被要求对具有 API 23 的设备的权限。不过,您并不是针对这些设备,您只是在编译代码,以便您可以包含那些缺少的资源。我的个人测试设备是 API 21,我用最新的 SDK 编译,它运行良好,如果这让你感觉更好
  • 谢谢。我将更新我的 sdk 并尝试这样做。如果我再次卡住,将删除评论。
猜你喜欢
  • 1970-01-01
  • 2016-08-15
  • 2016-03-04
  • 2015-02-10
  • 1970-01-01
  • 2016-02-26
  • 1970-01-01
  • 2014-12-22
  • 1970-01-01
相关资源
最近更新 更多