Error adding Google Identity Toolkit with Gradle

2019-08-30 11:54发布

问题:

I am trying to add the Google Identity Toolkit to my Google App Engine backend in Android Studio using Gradle. But I'm new to Android Studio and Gradle.

I have added the following to my backend build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.apis:google-api-services-identitytoolkit:v3-rev191-1.20.0'
}

After a sync and gradle build I try to added an import:

import com.google.identitytoolkit.GitkitClient;

But I am getting the following errors:

cannot resolve symbol 'identitytoolkit'

and

error: package com.google.identitytoolkit does not exists

回答1:

Well I feel a little bit stupid... I've realised my mistake:

I should have been using the Gradle config:

compile 'com.google.identitytoolkit:gitkitclient:1.2.3'

instead of

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.apis:google-api-services-identitytoolkit:v3-rev191-1.20.0'
}

using

http://search.maven.org/#artifactdetails%7Ccom.google.identitytoolkit%7Cgitkitclient%7C1.2.3%7Cjar

instead of

https://developers.google.com/api-client-library/java/apis/identitytoolkit/v3