2017-06-02 29 views
-1

我在最新的支持庫中遇到了奇怪的問題。 我只是遷移我的項目由GOOGLE提供的最新版本,並按照谷歌指引最新支持庫中面臨的問題v26.0.0-beta1

所以,問題是找不到cardView在最新的支持文件。有人遇到這個問題嗎?

這裏是我的應用程序文件搖籃

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

我沒有看到cardview加入到依賴於你的應用程序文件的gradle任何地方。嘗試添加:

compile 'com.android.support:cardview-v7:25.3.1'

+0

但我使用ext.support_libs = '26.0.0-beta1'版本支持庫和按照谷歌文檔Appcompat已經包含cardview所以不需要爲cardview添加額外的庫。更低的版本工作正常。但我在Android O遷移中遇到了這個問題 –

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' 
+0

但是我使用支持庫的ext.support_libs = '26.0.0-beta1'版本,並且根據google文檔Appcompat已經包含cardview,因此不需要爲cardview添加額外的庫。更低的版本工作正常。但是我在Android O遷移中遇到了這個問題 –

0

程序兼容性V7不包含CardView,你需要做的是LIB的明確要求您關聯。

因此,請將compile 'com.android.support:cardview-v7:$support_libs'添加到您的依賴項中。