无法解决:com.github.moondroid.coverflow:library:1.0

时间:2016-06-02 07:37:22

标签: android maven

CoverFlow is pushed to Maven Central as a AAR, so you just need to add the it's dependency to local build.gradle (usually locate in app module). Because of this libary is build in the min-sdk is 15, so your project must set same as it: 

但是当我尝试使用这个库时,我收到了这个错误

  

无法解决:com.github.moondroid.coverflow:library:1.0

这是我的傻瓜

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.example.maysara.theproject"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.github.moondroid.coverflow:library:1.0'
    compile 'com.android.support:cardview-v7:23.0.1'
    }

2 个答案:

答案 0 :(得分:3)

添加到您的graldle文件:

apply plugin: 'com.android.application'
    repositories {
            mavenCentral()
        }

答案 1 :(得分:1)

首先设置 minSdkVersion 15 而不是 16

你的Logcat说什么

  

因此您只需将其依赖项添加到本地build.gradle即可   (通常位于app模块中)。因为这个库是建立在   min-sdk是15,所以你的项目必须设置相同:

defaultConfig {
   applicationId "com.example.maysara.theproject"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

<强> FYI

启用将AAR文件发布到Maven Central

repositories {
      jcenter() // or  mavenCentral()
  }