Skip to content

Commit 7d7ea70

Browse files
committed
update SDK dependencies to latest
1 parent e8cf0a6 commit 7d7ea70

File tree

6 files changed

+41
-22
lines changed

6 files changed

+41
-22
lines changed

V4_MIGRATION_GUIDE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,25 @@ buildscript {
6262

6363
No breaking API changes have been identified in v4. This section will be updated if any are discovered.
6464

65+
## Dependency Changes
66+
67+
### ⚠️ Gson 2.8.9 → 2.11.0 (Transitive Dependency)
68+
69+
v4 updates the internal Gson dependency from **2.8.9** to **2.11.0**. While the SDK does not expose Gson types in its public API, Gson is included as a transitive runtime dependency. If your app also uses Gson, be aware of the following changes introduced in Gson 2.10+:
70+
71+
- **`TypeToken` with unresolved type variables is rejected at runtime.** Code like `object : TypeToken<List<T>>() {}` (where `T` is a generic parameter) will throw `IllegalArgumentException`. Use Kotlin `reified` type parameters or pass concrete types instead.
72+
- **Strict type coercion is enforced.** Gson no longer silently coerces JSON objects or arrays to `String`. If your code relies on this behavior, you will see `JsonSyntaxException`.
73+
- **Built-in ProGuard/R8 rules are included.** Gson 2.11.0 ships its own keep rules, so you may be able to remove custom Gson ProGuard rules from your project.
74+
75+
If you need to pin Gson to an older version, you can use Gradle's `resolutionStrategy`:
76+
77+
```groovy
78+
configurations.all {
79+
resolutionStrategy.force 'com.google.code.gson:gson:2.8.9'
80+
}
81+
```
82+
83+
> **Note:** Pinning to an older version is not recommended long-term, as the SDK has been tested and validated against Gson 2.11.0.
6584
6685
## Getting Help
6786

auth0/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,35 +81,35 @@ android {
8181

8282
ext {
8383
okhttpVersion = '4.12.0'
84-
coroutinesVersion = '1.7.3'
84+
coroutinesVersion = '1.10.2'
8585
biometricLibraryVersion = '1.1.0'
86-
credentialManagerVersion = "1.3.0"
86+
credentialManagerVersion = "1.5.0"
8787
}
8888

8989

9090
dependencies {
9191
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
92-
implementation 'androidx.core:core-ktx:1.6.0'
93-
implementation 'androidx.appcompat:appcompat:1.6.0'
94-
implementation 'androidx.browser:browser:1.4.0'
92+
implementation 'androidx.core:core-ktx:1.15.0'
93+
implementation 'androidx.appcompat:appcompat:1.7.0'
94+
implementation 'androidx.browser:browser:1.8.0'
9595
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
9696
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
9797

9898
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
99-
implementation 'com.google.code.gson:gson:2.8.9'
100-
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.4.0'
99+
implementation 'com.google.code.gson:gson:2.11.0'
100+
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
101101

102102
implementation "androidx.biometric:biometric:$biometricLibraryVersion"
103103

104104
testImplementation 'junit:junit:4.13.2'
105105
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
106-
testImplementation 'org.mockito:mockito-core:5.7.0'
107-
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.1.0'
106+
testImplementation 'org.mockito:mockito-core:5.14.0'
107+
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.4.0'
108108
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
109109
testImplementation "com.squareup.okhttp3:okhttp-tls:$okhttpVersion"
110110
testImplementation 'com.jayway.awaitility:awaitility:1.7.0'
111111
testImplementation 'org.robolectric:robolectric:4.14.1'
112-
testImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
112+
testImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
113113
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
114114

115115
testImplementation "androidx.biometric:biometric:$biometricLibraryVersion"

auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public class AuthenticationAPIClientTest {
225225
defaultLocale
226226
)
227227
)
228-
val body = bodyFromRequest<String>(request)
228+
val body = bodyFromRequest<Any>(request)
229229
assertThat(request.path, Matchers.equalTo("/oauth/token"))
230230
assertThat(body, Matchers.hasEntry("client_id", CLIENT_ID))
231231
assertThat(
@@ -254,7 +254,7 @@ public class AuthenticationAPIClientTest {
254254
defaultLocale
255255
)
256256
)
257-
val body = bodyFromRequest<String>(request)
257+
val body = bodyFromRequest<Any>(request)
258258
assertThat(request.path, Matchers.equalTo("/passkey/register"))
259259
assertThat(body, Matchers.hasEntry("client_id", CLIENT_ID))
260260
assertThat(body, Matchers.hasEntry("realm", MY_CONNECTION))
@@ -1034,7 +1034,7 @@ public class AuthenticationAPIClientTest {
10341034
)
10351035
)
10361036
assertThat(request.path, Matchers.equalTo("/dbconnections/signup"))
1037-
val body = bodyFromRequest<String>(request)
1037+
val body = bodyFromRequest<Any>(request)
10381038
assertThat(body, Matchers.hasEntry("email", SUPPORT_AUTH0_COM))
10391039
assertThat(body, Matchers.hasEntry("username", SUPPORT))
10401040
assertThat(body, Matchers.hasEntry("password", PASSWORD))
@@ -1058,7 +1058,7 @@ public class AuthenticationAPIClientTest {
10581058
)
10591059
)
10601060
assertThat(request.path, Matchers.equalTo("/dbconnections/signup"))
1061-
val body = bodyFromRequest<String>(request)
1061+
val body = bodyFromRequest<Any>(request)
10621062
assertThat(body, Matchers.hasEntry("email", SUPPORT_AUTH0_COM))
10631063
assertThat(body, Matchers.hasEntry("username", SUPPORT))
10641064
assertThat(body, Matchers.hasEntry("password", PASSWORD))
@@ -1361,7 +1361,7 @@ public class AuthenticationAPIClientTest {
13611361
)
13621362
)
13631363
assertThat(request.path, Matchers.equalTo("/dbconnections/signup"))
1364-
val body = bodyFromRequest<String>(request)
1364+
val body = bodyFromRequest<Any>(request)
13651365
assertThat(body, Matchers.hasEntry("email", SUPPORT_AUTH0_COM))
13661366
assertThat(body, Matchers.hasEntry("username", SUPPORT))
13671367
assertThat(body, Matchers.hasEntry("password", PASSWORD))
@@ -3132,8 +3132,8 @@ public class AuthenticationAPIClientTest {
31323132
assertThat(exception.cause, Matchers.instanceOf(DPoPException::class.java))
31333133
}
31343134

3135-
private fun <T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
3136-
val mapType = object : TypeToken<Map<String?, T>?>() {}.type
3135+
private inline fun <reified T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
3136+
val mapType = object : TypeToken<Map<String, T>>() {}.type
31373137
return gson.fromJson(request.body.readUtf8(), mapType)
31383138
}
31393139

auth0/src/test/java/com/auth0/android/management/UsersAPIClientTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ public class UsersAPIClientTest {
441441
)
442442
}
443443

444-
private fun <T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
445-
val mapType = object : TypeToken<Map<String?, T>?>() {}.type
444+
private inline fun <reified T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
445+
val mapType = object : TypeToken<Map<String, T>>() {}.type
446446
return gson.fromJson(request.body.readUtf8(), mapType)
447447
}
448448

auth0/src/test/java/com/auth0/android/myaccount/MyAccountAPIClientTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ public class MyAccountAPIClientTest {
467467
assertThat(body, Matchers.hasEntry("type", "push-notification" as Any))
468468
}
469469

470-
private fun <T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
471-
val mapType = object : TypeToken<Map<String?, T>?>() {}.type
470+
private inline fun <reified T> bodyFromRequest(request: RecordedRequest): Map<String, T> {
471+
val mapType = object : TypeToken<Map<String, T>>() {}.type
472472
return gson.fromJson(request.body.readUtf8(), mapType)
473473
}
474474

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
dependencies {
99
classpath 'com.android.tools.build:gradle:8.8.2'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath "org.jacoco:org.jacoco.core:0.8.5"
11+
classpath "org.jacoco:org.jacoco.core:0.8.12"
1212
}
1313
}
1414

0 commit comments

Comments
 (0)