0
votes

I have a project where i use Google Cloud Speech, and Firebase RealTime Database, and also as the project evolved i would like to add Google FireStore functionallity. But after I compile the dependency i have a RunTime error:

Error:(458, 21) error: no suitable method found for 
intercept(GoogleCredentialsInterceptor)
method zzbc.intercept(List<zzl>) is not applicable
(argument mismatch; GoogleCredentialsInterceptor cannot be converted to List<zzl>)
method zzbc.intercept(zzl...) is not applicable
(varargs mismatch; GoogleCredentialsInterceptor cannot be converted to zzl)
method AbstractManagedChannelImplBuilder.intercept(List<zzl>) is not applicable
(argument mismatch; GoogleCredentialsInterceptor cannot be converted to List<zzl>)
method AbstractManagedChannelImplBuilder.intercept(zzl...) is not applicable
(varargs mismatch; GoogleCredentialsInterceptor cannot be converted to zzl)

This error occurs when i try to get the credentials from GCS.

 @Override
    protected void onPostExecute(AccessToken accessToken) {
        mAccessTokenTask = null;
        final ManagedChannel channel = new OkHttpChannelProvider()
                .builderForAddress(HOSTNAME, PORT)
                .nameResolverFactory(new DnsNameResolverProvider())
                .intercept(new GoogleCredentialsInterceptor(new GoogleCredentials(accessToken)
                        .createScoped(SCOPE)))
                .build();
        mApi = SpeechGrpc.newStub(channel);

        // Schedule access token refresh before it expires
        if (mHandler != null) {
            mHandler.postDelayed(mFetchAccessTokenRunnable,
                    Math.max(accessToken.getExpirationTime().getTime()
                            - System.currentTimeMillis()
                            - ACCESS_TOKEN_FETCH_MARGIN, ACCESS_TOKEN_EXPIRATION_TOLERANCE));
        }
    }
}

The code is crashing at this part of code:

.intercept(new GoogleCredentialsInterceptor(new GoogleCredentials(accessToken).createScoped(SCOPE)))

My dependencies:

  ext {
    //FirebaseUI Version    Firebase/Play Services Version
    //     3.1.0                    11.4.2
    supportLibraryVersion = '27.0.0'
    grpcVersion = '1.7.0'
    googlePlayVersion = '11.4.2'
    firebaseVersion = '11.4.2'
    fireUIVersion = '3.1.0'
    facebookVersion = '4.27.0'
    glideVersion = '4.3.0'
}

  ...
  compile fileTree(include: ['*.jar'], dir: 'libs')
compile "io.grpc:grpc-okhttp:$grpcVersion"
compile "io.grpc:grpc-protobuf-lite:$grpcVersion"
compile "io.grpc:grpc-stub:$grpcVersion"
compile('com.google.auth:google-auth-library-oauth2-http:0.7.1') {
    exclude module: 'httpclient'
}

// Support Libraries:
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:preference-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:cardview-v7:$supportLibraryVersion"
compile "com.android.support:preference-v7:$supportLibraryVersion"
compile "com.google.android.gms:play-services-auth:$firebaseVersion"

// FirebaseUI for Firebase Auth

compile "com.google.android.gms:play-services-auth:$googlePlayVersion"
compile "com.google.firebase:firebase-database:$firebaseVersion"
compile "com.google.firebase:firebase-auth:$firebaseVersion"
compile "com.google.firebase:firebase-core:$firebaseVersion"
compile "com.google.firebase:firebase-firestore:$firebaseVersion"

compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
compile "com.android.support:support-v4:$supportLibraryVersion"

compile 'com.firebaseui:firebase-ui-auth:3.1.0'
compile 'com.android.support.constraint:constraint-layout-solver:1.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'javax.annotation:javax.annotation-api:1.2'

  apply plugin: 'com.google.gms.google-services'

The project level :

    buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
        classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
        classpath 'com.google.gms:google-services:3.1.1'
    }


allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url "https://jitpack.io" }
        maven {
            url  "http://dl.bintray.com/ahmedrizwan/maven"
        }
        maven {
            url "http://dl.bintray.com/glomadrian/maven"
        }

        mavenCentral()
    }
}

If i remove the:

     // TRYED WITH compile 'com.google.firebase:firebase-firestore:11.4.2'
  compile 'com.firebaseui:firebase-ui-auth:3.1.0'

All works great! But i need it for Firestore functionallity.

I have all API enabled, And Google Cloud Data Storage disabled.

Cloud Firestore and App Engine: You can't use both Cloud Firestore and Cloud Datastore in the same project, which might affect apps using App Engine. Try using Cloud Firestore with a different project.

1
This may not be the source of the crash, but you should correct the version of firebase-ui-auth to be 3.1.0. That is the compatible version for 11.4.2. See the dependency table in the docs.Bob Snyder
i updated for 3.1.0, but still same, oh and thank you for the tipSz-Nika Janos

1 Answers

1
votes

Sorry you're encountering this, but Firestore is not (currently) compatible with an external gRPC, as answered here:

Cloud Firestore with gRPC build error

The 11.8.0 release fixes this.