I have arrangements of vector images but when I run the app, it is truncated, what the phone displays is "Unfortunately, app has stopped" and what the logcat shows is:
03-29 01: 28: 37.177 3176-3176 / matgic.com.matgic E / VdcInflateDelegate: Exception while inflating android.content.res.Resources $ NotFoundException: File res / drawable-v22 / $ ic_strawberry__0.xml from color state list resource ID # 0x7f070023 Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line # 0: invalid color state list tag gradient
here the code:
int [] f2={R.drawable.ic_apple, R.drawable.ic_pineapple, R.drawable.ic_strawberry, R.drawable.ic_coconut};
img1.setImageResource(R.drawable.ic_strawberry);
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "matgic.com.matgic"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
//compile 'com.android.support:design:24.+'
compile 'com.android.support:design:26.1.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
testCompile 'junit:junit:4.12'
}