Skip to content

Commit 3a031f1

Browse files
authored
Update dependencies (#908)
2 parents 4fa184c + f522afc commit 3a031f1

File tree

9 files changed

+62
-34
lines changed

9 files changed

+62
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ Next, define the Manifest Placeholders for the Auth0 Domain and Scheme which are
117117
apply plugin: 'com.android.application'
118118
119119
android {
120-
compileSdkVersion 35
120+
compileSdkVersion 36
121121
defaultConfig {
122122
applicationId "com.auth0.samples"
123123
minSdkVersion 24
124-
targetSdkVersion 35
124+
targetSdkVersion 36
125125
//...
126126
127127
//---> Add the next line

V4_MIGRATION_GUIDE.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ android {
2929

3030
v4 requires:
3131

32-
- **Gradle**: 8.10.2 or later
33-
- **Android Gradle Plugin (AGP)**: 8.8.2 or later
32+
- **Gradle**: 8.11.1 or later
33+
- **Android Gradle Plugin (AGP)**: 8.10.1 or later
3434

3535
Update your `gradle/wrapper/gradle-wrapper.properties`:
3636

3737
```properties
38-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
38+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
3939
```
4040

4141
Update your root `build.gradle`:
4242

4343
```groovy
4444
buildscript {
4545
dependencies {
46-
classpath 'com.android.tools.build:gradle:8.8.2'
46+
classpath 'com.android.tools.build:gradle:8.10.1'
4747
}
4848
}
4949
```
@@ -67,6 +67,34 @@ buildscript {
6767
- [signinWithPasskey()](auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt#L235-L253) - Sign in a user using passkeys
6868
- [signupWithPasskey()](auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt#L319-L344) - Sign up a user and returns a challenge for key generation
6969

70+
## Dependency Changes
71+
72+
### ⚠️ Gson 2.8.9 → 2.11.0 (Transitive Dependency)
73+
74+
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+:
75+
76+
- **`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.
77+
- **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`.
78+
- **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.
79+
80+
If you need to pin Gson to an older version, you can use Gradle's `resolutionStrategy`:
81+
82+
```groovy
83+
configurations.all {
84+
resolutionStrategy.force 'com.google.code.gson:gson:2.8.9'
85+
}
86+
```
87+
88+
Alternatively, you can exclude Gson from the SDK entirely and provide your own version:
89+
90+
```groovy
91+
implementation('com.auth0.android:auth0:<version>') {
92+
exclude group: 'com.google.code.gson', module: 'gson'
93+
}
94+
implementation 'com.google.code.gson:gson:2.8.9' // your preferred version
95+
```
96+
97+
> **Note:** Pinning or excluding is not recommended long-term, as the SDK has been tested and validated against Gson 2.11.0.
7098
7199
## Getting Help
72100

auth0/build.gradle

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ logger.lifecycle("Using version ${version} for ${name}")
3535

3636
android {
3737
namespace 'com.auth0.android.auth0'
38-
compileSdk 35
38+
compileSdk 36
3939

4040
buildFeatures {
4141
buildConfig = true
4242
}
4343

4444
defaultConfig {
4545
minSdkVersion 21
46-
targetSdk 35
46+
targetSdk 36
4747
versionCode 1
4848
versionName project.version
4949

@@ -81,34 +81,34 @@ android {
8181

8282
ext {
8383
okhttpVersion = '4.12.0'
84-
coroutinesVersion = '1.7.3'
84+
coroutinesVersion = '1.10.2'
8585
biometricLibraryVersion = '1.1.0'
8686
}
8787

8888

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

9797
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
98-
implementation 'com.google.code.gson:gson:2.8.9'
99-
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.4.0'
98+
implementation 'com.google.code.gson:gson:2.11.0'
99+
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
100100

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

103103
testImplementation 'junit:junit:4.13.2'
104104
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
105-
testImplementation 'org.mockito:mockito-core:5.7.0'
106-
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.1.0'
105+
testImplementation 'org.mockito:mockito-core:5.14.0'
106+
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.4.0'
107107
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttpVersion"
108108
testImplementation "com.squareup.okhttp3:okhttp-tls:$okhttpVersion"
109109
testImplementation 'com.jayway.awaitility:awaitility:1.7.0'
110-
testImplementation 'org.robolectric:robolectric:4.14.1'
111-
testImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
110+
testImplementation 'org.robolectric:robolectric:4.15.1'
111+
testImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
112112
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
113113

114114
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ buildscript {
66
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.8.2'
9+
classpath 'com.android.tools.build:gradle:8.10.1'
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ plugins {
55

66
android {
77
namespace 'com.auth0.sample'
8-
compileSdk 35
8+
compileSdk 36
99

1010
defaultConfig {
1111
minSdk 24
12-
targetSdk 35
12+
targetSdk 36
1313
versionCode 1
1414
versionName "1.0"
1515

0 commit comments

Comments
 (0)