googleapis / googleapis/google-http-java-client

java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets in Android API < 19

Đang mở
#604 1 bình luận 3 reaction 0 người được giao Xem trên GitHub
type: feature request
Ngôn ngữ chính
Java
Star
1.4k
Fork
473
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,

we have problems with the latest version of your library in devices running Android 4.3 (API 18) or lower. `StandardCharsets` was added in Android API 19 so any call to methods using that (for example, `StringUtils.getBytesUtf8` or `StringUtils.newStringUtf8`) causes a crash in our app.

#### Environment details

- OS: **Android API < 19**
- google-http-java-client version: **1.28**

#### Stacktrace

```
java.lang.NoClassDefFoundError: java.nio.charset.StandardCharsets
at com.google.api.client.util.StringUtils.getBytesUtf8(StringUtils.java:52)
at com.google.api.client.json.webtoken.JsonWebSignature.signUsingRsaSha256(JsonWebSignature.java:636)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:388)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:494)
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217)
at com.google.api.client.googleapis.batch.BatchRequest$BatchInterceptor.intercept(BatchRequest.java:281)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:911)
at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:233)
at our.app.PubSubManager.sendTopic(PubSubManager.java:100)
at java.lang.Thread.run(Thread.java:841)
```

#### Any additional information below

https://developer.android.com/reference/java/nio/charset/StandardCharsets.html

####

Thanks!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.