I am create an application Translation App here i am doing first API is speech to text and then translate API calling when integrated both gradles its getting error.
//for Speech to Text Google API
implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoSuchMethodError: No static method decodeBase64(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar)
at com.google.api.client.util.Base64.decodeBase64(Base64.java:101)
at com.google.api.client.util.PemReader.readNextSection(PemReader.java:106)
at com.google.api.client.util.PemReader.readFirstSectionAndClose(PemReader.java:135)
at com.google.auth.oauth2.ServiceAccountCredentials.privateKeyFromPkcs8(ServiceAccountCredentials.java:296)
at com.google.auth.oauth2.ServiceAccountCredentials.fromPkcs8(ServiceAccountCredentials.java:286)
at com.google.auth.oauth2.ServiceAccountCredentials.fromJson(ServiceAccountCredentials.java:210)
at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:174)
at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:141)
at com.google.cloud.android.speech.SpeechService$AccessTokenTask.doInBackground(SpeechService.java:361)
at com.google.cloud.android.speech.SpeechService$AccessTokenTask.doInBackground(SpeechService.java:337)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Hi,
I am create an application Translation App here i am doing first API is speech to text and then translate API calling when integrated both gradles its getting error.
//for Speech to Text Google API implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') { exclude module: 'httpclient' }
// Translate API implementation ('com.google.cloud:google-cloud-translate:1.53.0'){ exclude module: 'commons-codec' exclude group: 'org.apache.httpcomponents' exclude group: 'org.json', module: 'json' }
Error :
java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NoSuchMethodError: No static method decodeBase64(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Base64; or its super classes (declaration of 'org.apache.commons.codec.binary.Base64' appears in /system/framework/org.apache.http.legacy.boot.jar) at com.google.api.client.util.Base64.decodeBase64(Base64.java:101) at com.google.api.client.util.PemReader.readNextSection(PemReader.java:106) at com.google.api.client.util.PemReader.readFirstSectionAndClose(PemReader.java:135) at com.google.auth.oauth2.ServiceAccountCredentials.privateKeyFromPkcs8(ServiceAccountCredentials.java:296) at com.google.auth.oauth2.ServiceAccountCredentials.fromPkcs8(ServiceAccountCredentials.java:286) at com.google.auth.oauth2.ServiceAccountCredentials.fromJson(ServiceAccountCredentials.java:210) at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:174) at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:141) at com.google.cloud.android.speech.SpeechService$AccessTokenTask.doInBackground(SpeechService.java:361) at com.google.cloud.android.speech.SpeechService$AccessTokenTask.doInBackground(SpeechService.java:337) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)
Please help me.
Thanks in advance.