Failed to resolve: com.android.support:cardview-v7

2018-12-31 02:16发布

i try to add recyclerview to my project and get this error appear and i added it from android studio dependencies this is error appear when try to add recyclerview in android studio

this is the compiled version ...

23条回答
还给你的自由
2楼-- · 2018-12-31 02:42
android {
     compileSdkVersion 26
     buildToolsVersion '26.0.2'
     useLibrary 'org.apache.http.legacy'
 defaultConfig {
    applicationId "com.test"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

this is working for me

查看更多
爱死公子算了
3楼-- · 2018-12-31 02:43

I face the same problem while I have updated my SDK and Android studio version(3.0 beta). I have solved this problem going through this tutorial. In this they told us to update are build configuration file like

android {
   compileSdkVersion 26
   buildToolsVersion '26.0.0'
   defaultConfig {
   targetSdkVersion 26
  }
  ...
}

dependencies {
   compile 'com.android.support:appcompat-v7:26.0.0'
}

// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android 8.0
repositories {
   maven {
       url 'https://maven.google.com'
       // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
   }
}

Hope it will help you out.

查看更多
余生请多指教
4楼-- · 2018-12-31 02:44

There is another way to add google repository

  1. Add gradle-4.1-rc-1-all in gradle-wrapper.properties.

    distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
    
  2. Then add google() in the top-level build.gradle

    allprojects {
      repositories {
        google()
        jcenter()
      }
    }
    
查看更多
春风洒进眼中
5楼-- · 2018-12-31 02:44

Clean your gradle from terminal

./gradlew clean

then use this code in your build.gradle section

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

Make sure, your included library version is available. For your checking, you can use this link

查看更多
公子世无双
6楼-- · 2018-12-31 02:44

in sdk 28 u can use

implementation 'com.android.support:design:28.0.0'

and remove cardView library

查看更多
登录 后发表回答