I am trying to follow the example here to perform an offline verification (https://github.com/googlesamples/android-play-safetynet/blob/master/server/java/src/main/java/OfflineVerify.java). However, when I tried to import the following classes, Android Studio indicated unresolved references
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.json.webtoken.JsonWebSignature;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
The unresolved references were api and DefaultHostnameVerifier.
Am I missing some settings?
Because the SDK where the DefaultHostnameVerifier class is located is not synchronized in the local Android studio. You need to add the dependency of two SDKs, google-http-client-jackson2 and httpclient, in the gradle file. You can see the corresponding configuration on GitHub:
https://github.com/googlesamples/android-play-safetynet/blob/master/server/java/build.gradle
dependencies {
compile 'com.google.http-client:google-http-client-jackson2:1.22.0'
// Apache HttpClient is used to verify the hostname against the signed certificate in OfflineVerify.
compile 'org.apache.httpcomponents:httpclient:4.5.2'
}