当我在Android版本6及更高版本上运行我的应用程序时,它运行完美但在版本<6时它会出错
"java.lang.NoClassDefFoundError: Failed resolution of:
Landroid/support/graphics/drawable/VectorDrawableCompat;".
当我从第一个路径运行时,我在两个不同的路径上有一个应用程序,它给出了上面提到的错误但是从另一个路径,它运行得很好。为什么有人能给我一个解决方案?
这是我的傻瓜
android {
compileSdkVersion 26
buildToolsVersion "26.0.3"
defaultConfig {
applicationId "xxx.xxx.xxx"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
}
repositories {
maven { url "https://maven.google.com" }
}
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.google.android.gms:play-services:11.0.4'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.5'
testCompile 'junit:junit:4.12'
}
正如在the documentation of VectorDrawableCompat中所说,这个类被添加到API 24.根据correspondence table,这是Android 7.0。
因此,在6.0以下的Android上找不到该类的预期行为