无法解析anko库版本0.9.1

时间:2017-02-02 09:10:51

标签: android kotlin anko

我正在尝试编译anko-test项目(https://github.com/yanex/anko-example.git),但gradle无法解析对库的依赖:

Error: A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find org.jetbrains.anko:anko-sdk15:0.9.1.
  Required by:
     anko-example:app:unspecified

这是我的gradle文件:

buildscript {
    ext.kotlin_version = '1.0.5-2'
    repositories {
         jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"

    defaultConfig {
        applicationId "org.example.ankodemo"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile 'org.jetbrains.anko:anko-sdk15:0.9.1'
}

克隆项目后,我没有改变任何事情,任何想法会发生什么?

1 个答案:

答案 0 :(得分:2)

看起来是known issue(该依赖关系尚未同步到jcenter)。

临时解决方案是将anko bintray存储库添加到根build.gradle文件中:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://dl.bintray.com/jetbrains/anko' }
    }
}