Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
程序类型已存在:com.google.logging.type.HttpRequestProto[Android]_Android_Firebase_Google Cloud Platform - Fatal编程技术网

程序类型已存在:com.google.logging.type.HttpRequestProto[Android]

程序类型已存在:com.google.logging.type.HttpRequestProto[Android],android,firebase,google-cloud-platform,Android,Firebase,Google Cloud Platform,我想在构建应用程序时使用Firebase和Google云平台API,但出现了错误。 起初,我认为这是由于“gRPC”组的过度使用造成的,因此我在Firestore的实现中排除了它,但它不起作用。 proto/google目录(用于创建protobuf)中的一些类/变量似乎已经通过Firestore或Storage或Auth呈现,但我在Firestore/Storage/Auth的实现中找不到它们(虽然我可以在proto/google目录中找到它们,但我不想在那里更改它们,因为我需要在调用'spe

我想在构建应用程序时使用Firebase和Google云平台API,但出现了错误。
起初,我认为这是由于“gRPC”组的过度使用造成的,因此我在Firestore的实现中排除了它,但它不起作用。
proto/google目录(用于创建protobuf)中的一些类/变量似乎已经通过Firestore或Storage或Auth呈现,但我在Firestore/Storage/Auth的实现中找不到它们(虽然我可以在proto/google目录中找到它们,但我不想在那里更改它们,因为我需要在调用'speech to text'API时使用它们)

那么你能告诉我如何解决这个问题吗

构建/升级(应用程序)如下所示:

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'

ext {
    supportLibraryVersion = '26.0.1'
    grpcVersion = '1.4.0'
    googleApiClientVersion =    '1.23.0'
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "{myAppId}"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
        resolutionStrategy.force "com.android.support:support-annotations:$supportLibraryVersion"
    }
}

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.3.0'
    }
    plugins {
        javalite {
            artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
        }
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite {}
                grpc {
                    // Options added to --grpc_out
                    option 'lite'
                }
            }
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    //add
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-storage:16.1.0'
    implementation ('com.google.firebase:firebase-firestore:18.1.0') {
        exclude group: 'io.grpc'
    }

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
//    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
    implementation 'com.android.support:customtabs:28.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test:runner:1.0.2') {
        exclude module: 'support-annotations'
    }
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2') {
        exclude module: 'support-annotations'
    }
    implementation 'com.android.support:support-annotations:28.0.0'

    // Support libraries
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'

    // gRPC
    implementation 'io.grpc:grpc-okhttp:1.16.1'
    implementation 'io.grpc:grpc-protobuf-lite:1.16.1'
    implementation 'io.grpc:grpc-stub:1.16.1'
    implementation 'javax.annotation:javax.annotation-api:1.2'
    protobuf 'com.google.protobuf:protobuf-java:3.4.0'

    // OAuth2 for Google API
    implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
        exclude module: 'httpclient'
    }

    // Dependencies for Google API Client Libraries
    implementation("com.google.http-client:google-http-client:$googleApiClientVersion") {
        exclude module: 'httpclient'
        exclude module: 'jsr305'
        exclude module: "guava-jdk5"
    }
    implementation("com.google.api-client:google-api-client-android:$googleApiClientVersion") {
        exclude module: 'httpclient'
        exclude module: 'jsr305'
        exclude module: "guava-jdk5"
    }
    implementation("com.google.apis:google-api-services-language:v1-rev386-1.22.0") {
        exclude module: 'httpclient'
        exclude module: 'jsr305'
        exclude module: "guava-jdk5"
    }

    implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'

task copySecretKey(type: Copy) {
    def File secretKey = file "$System.env.GOOGLE_APPLICATION_CREDENTIALS"
    from secretKey.getParent()
    include secretKey.getName()
    into 'src/main/res/raw'
    rename secretKey.getName(), "credential.json"
}
preBuild.dependsOn(copySecretKey)
构建/渐变:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.2.0'
        //change1
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

proto/google目录可在此处找到:

不包括其他protobuf lite依赖项:

    implementation("com.google.firebase:firebase-firestore:$firebaseFirestoreVersion") {
    exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
    }
来自。

这里显示了原始答案:

不包括其他protobuf lite依赖项:

    implementation("com.google.firebase:firebase-firestore:$firebaseFirestoreVersion") {
    exclude group: 'com.google.firebase', module: 'protolite-well-known-types'
    }
来自。
原来的答案如下: