未能解决支持向量可绘制

failed to resolved support-vector-Drawable

我的项目直到昨天都运行良好,但今天早上当我尝试构建它时,它一直抛出未能解决支持向量可绘制错误。 我尝试清理并出现此错误

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'. Could not find support-vector-drawable.aar (com.android.support:support-vector-drawable:26.0.2). Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-vector-drawable/26.0.2/support-vector-drawable-26.0.2.aar

这是我的 gradle

android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
    applicationId "com.arizeh.arizehplus"
    minSdkVersion 17
    targetSdkVersion 22
    multiDexEnabled true
    versionCode 29
    versionName "3.0.5"
    useLibrary 'org.apache.http.legacy'
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {

compile 'com.android.support:appcompat-v7:26+'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
}

这是我的关卡build.gradle文件

buildscript {
repositories {
    google()
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.2.1'
    classpath 'io.fabric.tools:gradle:1.24.4'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

}

}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'http://jhoobin.abroid.com/repo/' }
        maven { url "https://jitpack.io" }
        maven {
            url "https://maven.google.com"
        }
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

嗨,根据我的理解,请尝试下面的事情

一个正在用其他特定版本的 plus

替换您的应用紧凑版本依赖
compile 'com.android.support:appcompat-v7:26+'

替换为(请根据您的构建工具设置)

compile 'com.android.support:appcompat-v7:26.1.0'

还有一件事尝试更新您的构建工具版本。

所以经过半天的搜索和重建,最终它通过将我的 compileSdkVersion 和所有其他库升级到 27 来修复...我希望这对遇到这个问题的任何人有所帮助

defaultConfig {

    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

改为

defaultConfig {
  vectorDrawables.useSupportLibrary = true
}