1

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

克隆项目后我没有改变任何东西,知道发生了什么吗?

4

1 回答 1

2

看起来是一个已知问题(该依赖项尚未同步到 jcenter)。

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

allprojects {
    repositories {
        jcenter()
        maven { url 'https://dl.bintray.com/jetbrains/anko' }
    }
}
于 2017-02-02T10:31:52.520 回答