Anko: Could not get unknown property 'anko_version' for object of type...?

Created on 23 Aug 2017  路  2Comments  路  Source: Kotlin/anko

I am trying to use Anko with my Android Kotlin Project. I have added the line to my dependencies / gradle module file as follows:

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'
}

But I get the following error when trying to do a gradle sync:

Error:(36, 0) Could not get unknown property 'anko_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
<a href="openFile:/Users/xxx/app/build.gradle">Open File</a>

Any ideas?

Most helpful comment

you shoud write
ext.anko_version='0.10.1'
in build.gradle (module: app) the same as picture
screen shot 2017-08-23 at 13 59 02

All 2 comments

you shoud write
ext.anko_version='0.10.1'
in build.gradle (module: app) the same as picture
screen shot 2017-08-23 at 13 59 02

ext.anko_version='0.10.1'
It's a thing that should be in the readme file

Was this page helpful?
0 / 5 - 0 ratings