0
当我同步我的项目时,出现SrcCompat错误。我有一个数字按钮和4个ImageViews的相对布局。这里是ImageViews之一:srcCompat API 22出错
<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输出1 4的相同误差:
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'
I”已经尝试:将srcCompat更改为src(我得到一个意外的命名空间错误),将res-auto更改为命名空间,更改完成-v7版本,重新启动,使项目,使缓存无效,清理等,如No resource identifier found for attribute 'srcCompat' in package 'learnapp.android.example.com.learnapp'
我正在尝试定位棒棒糖并最终转移到API 23.感谢您的建议!
可能重复[未找到属性'srcCompat'的资源标识符'包'learnapp.android.example。 com.learnapp'](http://stackoverflow.com/questions/38161864/no-resource-identifier-found-for-attribute-srccompat-in-package-learnapp-andr) – Chisko
我尝试了以前的每个建议链接已更改srcCompat,更改了res-auto,更改了appcompatv7版本。没有工作! – DHHJ
你是否更新了''com.android.support:appcompat-v7:22.2.0''到最新版本?我认为它是22.2.1 – Chisko