gpt4 book ai didi

java - Google Cloud Speech to Text 错误 : java. lang.NoSuchMethodError: No virtual method build()Lcom/google/protobuf/GeneratedMessageLite;

转载 作者:行者123 更新时间:2023-11-29 23:01:53 25 4
gpt4 key购买 nike

我正在使用 Google Cloud Speech 发短信。出于某种原因,它只在第一次起作用。之后,这个错误不断出现。我卡住了。

java.lang.NoSuchMethodError: No virtual method build()Lcom/google/protobuf/GeneratedMessageLite; in class Lcom/google/cloud/speech/v1/RecognitionConfig$Builder; or its super classes (declaration of 'com.google.cloud.speech.v1.RecognitionConfig$Builder'

build.gradle 模块应用

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

ext {
grpcVersion = '1.4.0' }

android {
compileSdkVersion 28
defaultConfig {
applicationId "app.android.com.colconvert"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

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

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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.intellij:annotations:+@jar'

implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

// gRPC
implementation "io.grpc:grpc-okhttp:$grpcVersion"
// implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation 'javax.annotation:javax.annotation-api:1.2'
protobuf 'com.google.protobuf:protobuf-java:3.3.1'
implementation group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '0.1.13'
// OAuth2 for Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
implementation 'com.android.support:multidex:1.0.0'
}

最佳答案

我认为您使用的版本有问题。我建议使用 latest version像下面这样。

implementation group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '1.10.0'

希望对您有所帮助!

关于java - Google Cloud Speech to Text 错误 : java. lang.NoSuchMethodError: No virtual method build()Lcom/google/protobuf/GeneratedMessageLite;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56875343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com