我在最新的支持库中遇到了奇怪的问题。 我刚刚将我的项目迁移到GOOGLE提供的最新支持版本,并根据谷歌指南
所以问题是无法在最新的支持文件中找到 cardView 。有人面临这个问题吗?
这是我的App Gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0-rc2"
defaultConfig {
applicationId "com.temp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
lintOptions {
disable 'RestrictedApi'
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$support_libs"
compile "com.android.support:design:$support_libs"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'jp.wasabeef:blurry:2.1.1'
}
// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android O
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
这是项目gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.support_libs = '26.0.0-beta1'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:0)
我没有在应用程序gradle文件的任何位置添加 cardview 添加到依赖项。尝试添加:
C:\wamp64\www\public_html\step
C:\wamp64\www\public_html
C:\wamp64\www
C:\wamp64
答案 1 :(得分:0)
在gradle文件中添加这些依赖项:
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
答案 2 :(得分:0)
AppCompat v7不包含CardView,您需要在依赖项中明确声明该lib。
因此,请将compile 'com.android.support:cardview-v7:$support_libs'
添加到您的依赖项中。