googlesamples / googlesamples/mlkit
[Bug report] TranslateException encountered using translation feature
- Dominant language
- Kotlin
- Stars
- 4.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
During the use of translate, a `TranslateException` is thrown, specifically indicating an `IllegalArgumentException` with the key data.
**To Reproduce**
While the exact steps to reproduce this behavior in the sample app may vary based on your specific setup and usage, the exception is thrown during the execution of the translation operation using Google Cloud Translate API.
```
com.google.cloud.translate.TranslateException: java.lang.IllegalArgumentException: key data
at com.google.cloud.translate.TranslateImpl.translate(SourceFile:132)
at com.google.cloud.translate.TranslateImpl.translate(SourceFile:138)
...
```
**Expected behavior**
Expected behavior is the successful translation operation without exceptions.
**SDK Info:**
- SDK Name & Version: AGP version 8.0.2, Gradle version 8.1.1
**Smartphone:**
- iPhone 7
**Development Environment:**
- IDE version: Android Studio 2022.2.1
**Solution**
The issue can be resolved by adding the following line to the ProGuard configuration:
```
-keep class com.google.api.services.translate.model.** { *; }
```
If you are experiencing a similar issue, please consider including this rule in your ProGuard configuration.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.