【问题标题】:srcCompat Error with API 22API 22 的 srcCompat 错误
【发布时间】:2017-02-15 09:20:09
【问题描述】:

我在同步项目时遇到 SrcCompat 错误。我有一个带有数字按钮和 4 个 ImageViews 的相对布局。这是其中一个 ImageView:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.bigal.datacollecter_v1.MainActivity">
<ImageView
    android:id="@+id/imLogoLL"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@android:drawable/arrow_down_float"
    android:layout_above="@+id/imRinkL"
    android:layout_alignLeft="@+id/imRinkL"/>

....... 

这是我的 build.gradle:

apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
    applicationId "com.example.bigal.datacollecter_v1"
    minSdkVersion 11
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'

这是来自 gradle 控制台输出的 4 个相同错误中的 1 个:

C:\Users\bigal\AndroidStudioProjects\DataCollecter_V1\app\src\main\res\layout\activity_main.xml
Error:(766) No resource identifier found for attribute 'srcCompat' in package 'com.example.bigal.datacollecter_v1' 

我尝试过:根据@987654321 将 srcCompat 更改为 src(我收到一个意外的命名空间错误)、将 res-auto 更改为命名空间、更改 acccompat-v7 版本、重新启动、制作项目、使缓存无效、清理等@

我正在尝试以 Lollipop 为目标并最终迁移到 API 23。感谢您的建议!

【问题讨论】:

标签: android android-studio-2.2


【解决方案1】:

我无法让它工作。我创建了一个新项目并将所有文件和代码传输过来,它工作正常............

【讨论】:

    猜你喜欢
    • 2015-08-09
    • 1970-01-01
    • 2016-09-14
    • 1970-01-01
    • 1970-01-01
    • 2013-11-16
    • 2018-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多