Sam Stone Sam Stone - 8 days ago 6
Android Question

Android Studio compiling for sdk version 19

I need to compile my project(which is very simple, it's almost empty) with targetSdk and compileSdk versions 19. Here is my gradle file:

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'
}


As far as I know, I am using the proper appcompat library - it must be the same as targetSdk and compileSdk versions, though it does not compile with 19.0.0, it says, that it is out of date and automatically switches it to 19.1.0. I even tried to get rid of the appcompat library at all(there was a hint that at this sdk version I have no need in that).

After every change in gradle file I clean and resync the project. Though I still get the same bunch of errors:

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'.


I did not insert all the errors, they are pretty much the same and there are 203 of them. What could be the problem?

P.S. This is not a duplicate. I need to compile for version 19, not 21. Please, before downvoting, make sure, that you understood the question. I need to make it work!

Answer

Material Design was introduced in API 20.

When importing:

compile 'com.google.android.gms:play-services:8.3.0'

You really import appcompat-v7:22.2.0. See the dependencies here

You should declare at most:

compile 'com.google.android.gms:play-services:5.0.89'