Text Translate -> TranslateException: An error occurred when translating: SERVICE_UNAVAILABLE, VoiceToText -> Error: 7
easyhooon opened this issue · comments
Hello Philip,
I thoroughly enjoyed your recent lecture on Android clone coding. After completing the course and testing the project, I encountered a bug as described above. To understand the problem, I cloned the code from the project you posted on GitHub and compared it with my own. Interestingly, I discovered that the same error also occurs in the cloned project.
While it's possible that there might be an issue with the code I wrote, the fact that the same problem also happens in the cloned project leads me to suspect that there could be an issue related to server communication. Could you possibly look into both the code and the server communication aspects?
TextTranslate Error comment:
com.plcoding.translator_kmm.translate.domain.translate.TranslateException: An error occurred when translating: SERVICE_UNAVAILABLE
full error log
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W com.plcoding.translator_kmm.translate.domain.translate.TranslateException: An error occurred when translating: SERVICE_UNAVAILABLE
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at com.plcoding.translator_kmm.translate.data.translate.KtorTranslateClient.translate(KtorTranslateClient.kt:36)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at com.plcoding.translator_kmm.translate.data.translate.KtorTranslateClient$translate$1.invokeSuspend(Unknown Source:15)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.988 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.989 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:141)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun.access$resumeRootWith(SuspendFunctionGun.kt:14)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:58)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
2023-10-28 08:50:36.990 28782-28782 System.err com.plcoding.translator_kmm.android W at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at android.os.Handler.handleCallback(Handler.java:958)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at android.os.Handler.dispatchMessage(Handler.java:99)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at android.os.Looper.loopOnce(Looper.java:205)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at android.os.Looper.loop(Looper.java:294)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at android.app.ActivityThread.main(ActivityThread.java:8177)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at java.lang.reflect.Method.invoke(Native Method)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
2023-10-28 08:50:36.991 28782-28782 System.err com.plcoding.translator_kmm.android W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
VoiceToText -> Error: 7 seems to occur when a non-word sound like "Ah~"., otherwise, it appears to identify properly when spoken in English. However, the translation does not work afterward due to the previously mentioned error.
There was a typo in BASE_URL I'm sorry