我正在尝试编译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'
}

克隆项目后,我没有做任何更改,有什么想法吗?

最佳答案

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

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

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

关于android - 解决anko库版本0.9.1的问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41998155/

10-11 00:45