Android 错误:(122,21)未找到与给定名称匹配的资源:
我正在尝试开发一个主要支持JellyBean和KitKat版本的应用程序 我已经下载了所有必要的API,正在尝试从旧的API(19.1.0)编译代码。但我得到了一些错误,并自动计算了这些值- 将打开values-v21.xml和values-v23.xml。我该怎么办Android 错误:(122,21)未找到与给定名称匹配的资源:,android,Android,我正在尝试开发一个主要支持JellyBean和KitKat版本的应用程序 我已经下载了所有必要的API,正在尝试从旧的API(19.1.0)编译代码。但我得到了一些错误,并自动计算了这些值- 将打开values-v21.xml和values-v23.xml。我该怎么办 C:\Users\lf_fr_000\AndroidStudioProjects\AppSicit2\app\build\intermediates\exploded-aar\com.android.support\appco
C:\Users\lf_fr_000\AndroidStudioProjects\AppSicit2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\res\values-v21\values-v21.xml
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:TextAppearance.Material.Button'.
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:Theme.Material'.
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:Widget.Material.ProgressBar'.
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.Body2'.
C:\Users\lf_fr_000\AndroidStudioProjects\AppSicit2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\res\values-v21\values-v21.xml
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:Widget.Material.EditText'.
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.Large.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:Theme.Material.Light'.
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.Caption'.
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:TextAppearance.Material.Display2'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
(...)
C:\Users\lf_fr_000\AndroidStudioProjects\AppSicit2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.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'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\lf_fr_000\AppData\Local\Android\sdk\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 1
我的模块设置:
Compile Sdk Version = API 19 4.4 (KitKat)
Build Tools Version = 19.1.0
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
我的渐变设置:
Compile Sdk Version = API 19 4.4 (KitKat)
Build Tools Version = 19.1.0
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
您的compileSdk版本必须与支持库的主版本匹配。目标sdkVersion应该与compileSdk版本匹配。最终的代码如下
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
希望能解决您的问题。您的compileSdk版本必须与支持库的主版本匹配。目标sdkVersion应该与compileSdk版本匹配。最终的代码如下
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
希望能解决你的问题。@Felipe Fronchetti
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
你的logcat扔了什么
实际上,compileSdkVersion让您的应用程序能够访问最新的API、样式和主题。如果尝试使用比compileSdkVersion更新的Android版本中引入的API,则会出现编译错误
因此,基本上,请更新您的compileSdkVersion
级别,
您正在使用compile'com.android.support:appcompat-v7:23.0.1'
因此请更新您的compileSdkVersion
和buildToolsVersion
compileSdkVersion 23
buildToolsVersion "23.0.0"
最后
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
@Felipe Fronchetti
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
你的logcat扔了什么
实际上,compileSdkVersion让您的应用程序能够访问最新的API、样式和主题。如果尝试使用比compileSdkVersion更新的Android版本中引入的API,则会出现编译错误
因此,基本上,请更新您的compileSdkVersion
级别,
您正在使用compile'com.android.support:appcompat-v7:23.0.1'
因此请更新您的compileSdkVersion
和buildToolsVersion
compileSdkVersion 23
buildToolsVersion "23.0.0"
最后
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.app.fronchetti.appsicit"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}
请核对我的答案请核对我的答案