안드로이드/에러

GoogleCloud Speech (STT)에러

코딩하는후운 2022. 11. 24. 10:49
반응형

처음 구현했을 때에는 되었는데 갑자기 안된다..

1. 

https://stackoverflow.com/questions/64668851/why-the-firestore-isnt-working-on-android-studio

  • io.grpc:grpc-okhttp:1.10.0 → io.grpc:grpc-okhttp:1.32.2

2. 

  • google-cloud-speech → google-cloud-speech:1.29.1로 올려봄.

3. 

gradle library 버전을 바꾸면서 각각 제공하지 않는 메소드가 잇는것 같다…


많이 사용하는 것 같은 버전 적용.

https://mvnrepository.com/artifact/com.google.cloud/google-cloud-speech

https://mvnrepository.com/artifact/io.grpc/grpc-okhttp

implementation 'io.grpc:grpc-okhttp:1.38.0'
implementation 'com.google.cloud:google-cloud-speech:1.24.6'

 

결론.

해당 기능 제공하는 Maven 버전들을 잘 찾아서 적용해야 할듯….


나의 앱에 넣어보기

Caused by: java.lang.RuntimeException: Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.0 (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0

implementation 중복 충돌

  • com.google.protobuf

 

protobuf-javalite제공하는 앱인것 같다.

https://stackoverflow.com/questions/62764605/updated-firebase-dependency-and-got-duplicated-protobuf-classes-error

 

Updated firebase dependency and got duplicated protobuf classes error

I'm getting this error after updating one of my firebase SDKs FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. > 1 except...

stackoverflow.com

  • Here is the list of affected SDKs and their versions supporting protobuf-javalite
- com.google.firebase:firebase-firestore:21.5.0
- com.google.firebase:firebase-inappmessaging:19.1.0
- com.google.firebase:firebase-inappmessaging-display:19.1.0
- com.google.firebase:firebase-config:19.2.0
- com.google.firebase:firebase-abt:19.1.0
- com.google.firebase:firebase-perf:19.0.8

 

확인결과

  • com.google.firebase:firebase-perf
  • com.google.firebase:firebase-inappmessaging-display

두 라이브러리에서 의존성이 겹침.

 

첫 번째 시도

implementation('com.google.cloud:google-cloud-speech:1.24.6') {
    exclude group: "com.google.protobuf"
}
  • 구글 클라우드 speech에 exclude 시켜보았습니다.
    • Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.0 (com.google.api.grpc:proto-google-common-protos:2.0.0) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)
    • proto-google-common-protos 와 protolite-well-known-types가 충돌 되는듯하다(?)
    • 못 찾는듯 하다(?)

 

https://github.com/stripe/stripe-terminal-android/issues/135

Stripe
+— com.google.protobuf:protobuf-java-util:3.11.4
| +— com.google.protobuf:protobuf-java:3.11.4

Firebase Performance Monitoring
+— com.google.firebase:protolite-well-known-types:17.1.1
| | | \— com.google.protobuf:protobuf-javalite:3.14.0
| | +— com.google.protobuf:protobuf-javalite:3.14.0

파이어베이스 protobuf-javalite랑 구글 protobuf-java이랑 충돌나는 것 같다.

https://community.remotemonster.com/t/sdk/600

protobuf-java 와 protobuf-lite 의 충돌로 인한 문제로 보입니다.
앱의 build.gradle에 protobuf-java를 제외하고 실행을 시켜보셨으면 합니다.

.
.
그 뒤로 계속 에러~
.

파이어베이스쪽으로 exclude해보자

  • perf, inappmessaging-display 뒤에 버전은 해당 버전들이 낮은것 같아서 옆에 올려주었다.
  • https://firebase.google.com/support/release-notes/android
    • 해당 링크에서 maven버전 비교해서 버전B에 있는 버전을 적어주었다.
    • com.google.firebase:firebase-bom:27.1.0 에 최신버전 적어주니 다른곳에도 영향이 생김.

 

빌드는 성공 -> 런타임에 에러가 난다

implementation('com.google.firebase:firebase-perf:20.0.6') {
    exclude module: 'protobuf-java'
    exclude module: 'proto-google-common-protos'
    exclude module: 'protolite-well-known-types'
    exclude module: 'protobuf-javalite'
}

implementation('com.google.firebase:firebase-inappmessaging-display:20.1.2') {
    exclude module: 'protobuf-java'
    exclude module: 'proto-google-common-protos'
    exclude module: 'protolite-well-known-types'
    exclude module: 'protobuf-javalite'
}
  • 빌드는 성공
  • E/: CrashError: java.lang.NoClassDefFoundError: Failed resolution of: Lio/grpc/CallCredentials2;
  • 파이어 베이스의 모듈을 exclude했지만 CallCredentials2를 못찾음.

 

implementation('com.google.cloud:google-cloud-speech:1.24.6') {
    exclude module: 'protobuf-java'
    exclude module: 'proto-google-common-protos'
    exclude module: 'protolite-well-known-types'
    exclude module: 'protobuf-javalite'
}
  • CrashError: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/protobuf/GeneratedMessageV3;
  • GeneratedMessageV3 를 못찾음.

implementation('com.google.cloud:google-cloud-speech:1.24.6') {
    exclude module: 'protobuf-java'
    exclude module: 'protobuf-javalite'
}

implementation('com.google.firebase:firebase-perf:20.0.6') {
    exclude module: 'proto-google-common-protos'
    exclude module: 'protolite-well-known-types'
}

implementation('com.google.firebase:firebase-inappmessaging-display:20.1.2') {
    exclude module: 'proto-google-common-protos'
    exclude module: 'protolite-well-known-types'
}

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.google.cloud.speech.v1.StreamingRecognizeResponse, unresolved supertypes: com.google.protobuf.GeneratedMessageV3

 

음.. 결국 실패하였다.(왠지 라이브러리 버전들을 잘 implementation 해야 할것 같은..)
기술 검토 기간이라 샘플앱 + 구글 클라우드로 빌드해서 기술 검토 하였습니다.

추후에 다시 적용할때 이력을 위해 정리

반응형