我正在尝试将 Anko 与我的 Android Kotlin 项目一起使用。我已将该行添加到我的依赖项/gradle 模块文件中,如下所示:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.anko:anko:$anko_version"
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-vector-drawable:26.+'
compile 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
但是在尝试进行 gradle 同步时出现以下错误:
错误:(36, 0) 无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象获取未知属性“anko_version”。打开文件
如何正确地将 Anko 融入我的项目中?
作为参考,我使用的是 Android Studio 2.0。