Could not resolve com.android.support:appcompat-v7:28.0.0问题的解决

与世无争的帅哥 提交于 2020-01-12 04:53:55

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.

这个问题一般是找不到相关依赖导致的。

问题出在app下的build gradle中指定的android sdk的版本,找不到对应的依赖库导致。

解决方法是:找到一个可以在本地编译通过的build.gradle的配置,将

compileSdkVersion

targetSdkVersion

修改为配置中的版本号。

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.taobao.android.mnndemo"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_shared"
                abiFilters 'armeabi-v7a'
            }
        }
    }

然后将dependencies中相关的与sdk版本相关的数字,修改为与compileSdkVersion 一样即可。如果compileSdkVersion 为28,则将27+修改为28+即可。

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:27+'
    implementation 'com.android.support:cardview-v7:27+'
}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!