我正在尝试开发一个主要支持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\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
我的Gradle设置:
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'
}
答案 0 :(得分:3)
@Felipe Fronchetti
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
实际上 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'
}