无法为类型对象获取未知属性'anko_version'?

arc*_*e16 5 android gradle kotlin anko

我正在尝试将Anko与我的Android Kotlin项目一起使用.我已将该行添加到我的dependencies/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'
}
Run Code Online (Sandbox Code Playgroud)

但是在尝试执行gradle同步时出现以下错误:

错误:(36,0)无法为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler类型的对象获取未知属性'anko_version'.打开文件

如何在项目中正确合并Anko?

作为参考,我使用的是Android Studio 2.0.

Bob*_*Bob 7

anko_versionext块上方添加dependencies块:

ext {
   anko_version = '0.10.1'
}
Run Code Online (Sandbox Code Playgroud)

另一种选择,如Naetmul的意见建议,是替代$anko_version0.10.1