2

Running on Windows 10 with Android studio 3 using com.google.cloud:google-cloud-vision:0.28.0-beta

with these package options in the build.gradle

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'

    exclude 'project.properties'
    exclude 'META-INF/io.netty.versions.properties'
    exclude 'META-INF/INDEX.LIST'
}

After building the app using the local image sample code found in https://cloud.google.com/vision/docs/detecting-fulltext

I've followed the directions from https://cloud.google.com/vision/docs/auth

and down paths 1 & 2 in "How the Application Default Credentials work" from https://developers.google.com/identity/protocols/application-default-credentials

As well as other SO stuff like GOOGLE_APPLICATION_CREDENTIALS error

following step 1 combined with the linked SO and running gcloud auth application-default print-access-token prints the access token

following step 2 with gcloud auth application-default login gives

Credentials saved to file: [C:\Users\USER\AppData\Roaming\gcloud\application_default_credentials.json]

These credentials will be used by any library that requests Application Default Credentials.

yet no matter what i do, the app always crashes with java.io.IOException: The Application Default Credentials are not available. This is additionally verified outside of executing an AnnotateImageRequest by running the code linked after paths 1&2 to see if i can fetch credentials programatically.

    return Single.fromCallable(new Callable<Object>() {
        @Override
        public Object call() throws Exception {
            GoogleCredential credential = GoogleCredential.getApplicationDefault();

            return new Object();
        }
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());

Where the GoogleCredential object is available through implementation 'com.google.api-client:google-api-client:1.23.0' and

android {
...
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
...
}

I'm 50 tabs deep with no answer working and I'm hoping someone here has run into this and can help me because otherwise I'm completely stuck

Ion
  • 334
  • 3
  • 15
  • Check app-engine application id. It should match your project id on google cloud platform. – Ajeet Nov 15 '17 at 15:55
  • If i understood you correctly. Making sure Project ID foo-12345 is matched by: android { defaultConfig { applicationId "com.example.me.foo" } }? If so, i already have that – Ion Nov 18 '17 at 22:04

0 Answers0