Failed to resolve variable '${animal.sniffer.version}' when migrate to AndroidX
Solution 1:
I fix this with two steps
1) File -> Invalidate Caches / restart...
2) Build -> Clean project
Solution 2:
I got the same error after updating my build.gradle file with AndroidX Test dependencies. Turns out I forgot to remove the old junit dependency. So for me, the fix was simply to remove the following dependency:
dependencies {
...
testImplementation 'junit:junit:4.12'
}
Solution 3:
Adding Java 8 support to build.gradle file fixed issue for me
android {
...
//Add the following configuration in order to target Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}