我正在解决此错误,无法运行Google云语音转文本。
程序类型已经存在:com.google.protobuf.AbstractProtobufList
我无法找出哪个其他依赖项具有AbstractProtobufList
。我是Protobuf
的新手。 Gradle
同步中没有问题。但是当我运行该项目时,它给出了错误。我什至启用了multidex
并添加了multidex
依赖项。
成绩文件:
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
ext {
grpcVersion = '1.4.0'
}
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.SpeechServiceDemo"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
protobuf {
protoc {
// You still need protoc like in the non-Android case
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// In most cases you don't need the full Java output
// if you use the lite output.
remove java
}
task.plugins {
javalite {}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//AzureDepedencies
implementation 'com.microsoft.cognitiveservices.speech:client-sdk:1.1.0'
//end
//GoogleCloudSpeechServices
// gRPC
compile "io.grpc:grpc-okhttp:$grpcVersion"
compile "io.grpc:grpc-protobuf-lite:$grpcVersion"
compile "io.grpc:grpc-stub:$grpcVersion"
compile 'javax.annotation:javax.annotation-api:1.2'
protobuf 'com.google.protobuf:protobuf-lite:3.0.1'
compile group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '0.1.13'
// OAuth2 for Google API
compile('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
compile 'com.android.support:multidex:1.0.3'
//end
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}