0

I downloaded and opened a starter code for an Android online course I'm following. The project builds fine but when I run the project I get the following errors.

[TAG] Failed to resolve variable '${junit.version}'
[TAG] Failed to resolve variable '${animal.sniffer.version}'
[TAG] Failed to resolve variable '${project.version}'

I am new to android development and android studio so I do not even know where to start troubleshooting. After checking out some of the questions I happen to understand these type of problems are usually associated with the buil.gradle file so I am including that here.

This is my Build Gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    dataBinding {
        enabled = true
    }
    defaultConfig {
        applicationId 'com.example.android.navigation'
        minSdkVersion 19
        targetSdkVersion 28
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"

    // Constraint Layout
    implementation "androidx.constraintlayout:constraintlayout:$version_constraint_layout"

    // Core
    implementation "androidx.core:core:$version_core"

    // Material Design
    implementation "com.google.android.material:material:$version_material"
}

Any help would be highly appreciated, at least even how to locate the cause when I get this type of an error.

0

3 Answers 3

2

Add version number in same line instead of $version...

like for your all dependencies

implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 
Sign up to request clarification or add additional context in comments.

Comments

1

You need to specify the versions of the libraries and the materials you are using . Instead of $version_kotlin replace it with the latest version of the Kotlin. Do the similar for all the lines.

Comments

0

You didn't specify the versions of the libraries

Replace the $version_kotin :

apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    dataBinding {
        enabled = true
    }
    defaultConfig {
        applicationId 'com.example.android.navigation'
        minSdkVersion 19
        targetSdkVersion 28
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0"
    // Constraint Layout
    implementation "androidx.constraintlayout:constraintlayout:1.1.3"
    // Core
    implementation "androidx.core:core:1.0.1"
    // Material Design
    implementation "com.google.android.material:material:1.1.0-alpha06"
}

I hope this helps....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.