我需要使用targetSdk和compileSdk版本19编译我的项目(非常简单,几乎是空的)。这是我的gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 19
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.my.app"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.appsflyer:af-android-sdk:4.6.0@aar'
}
据我所知,我使用的是正确的appcompat库-它必须与targetSdk和compileSdk版本相同,尽管它没有使用19.0.0进行编译,但它表示已过时并自动将其切换为19.1。 .0。我什至试图完全摆脱appcompat库(有一个提示,在此sdk版本中,我不需要这样做)。
gradle文件中的每个更改后,我都会清理并重新同步项目。虽然我仍然遇到同样的错误:
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'.
Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'.
Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'.
Error:(206) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(208) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(211) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
我没有插入所有错误,它们几乎相同,其中有203个。可能是什么问题呢?
附言这不是重复项。我需要才能针对版本19(而不是21)进行编译。请在降低投票权之前,确保您已理解问题。我需要使它工作!
最佳答案
API 20中介绍了 Material 设计。
导入时:
compile 'com.google.android.gms:play-services:8.3.0'
您确实导入了
appcompat-v7:22.2.0
。查看依赖项here您最多应该声明:
compile 'com.google.android.gms:play-services:5.0.89'
关于android - 适用于SDK版本19的Android Studio编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40907996/