Android Studio : Cannot resolve symbol "Truth" (Truth library)

To use the Java 8 extensions, also include com.google.truth.extensions:truth-java8-extension:0.40.

NOTE

You should call androidTestImplementation

androidTestImplementation "com.google.truth:truth::0.40" // Latest version 1.1.3

Read more information about Truth - Fluent assertions for Java .


Add the appropriate dependency to your build file:

testImplementation "com.google.truth:truth:1.0.1"

You need the Java 8 extensions if and only if you're testing Java 8 code (Stream, Optional, etc):

testImplementation "com.google.truth.extensions:truth-java8-extension:1.0.1"