diff --git a/README.md b/README.md index 0ee3ba1052..d45072e960 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ block inside your app's `build.gradle`, as below: android { compileOptions { coreLibraryDesugaringEnabled true - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } } ``` diff --git a/aws-analytics-pinpoint/build.gradle.kts b/aws-analytics-pinpoint/build.gradle.kts index c3c99f6fc4..b3a68ace5b 100644 --- a/aws-analytics-pinpoint/build.gradle.kts +++ b/aws-analytics-pinpoint/build.gradle.kts @@ -51,3 +51,7 @@ dependencies { androidTestImplementation(libs.test.androidx.junit) androidTestImplementation(project(":aws-analytics-pinpoint")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-api-appsync/build.gradle.kts b/aws-api-appsync/build.gradle.kts index 19cfd8d955..5df4653661 100644 --- a/aws-api-appsync/build.gradle.kts +++ b/aws-api-appsync/build.gradle.kts @@ -37,3 +37,7 @@ dependencies { testImplementation(project(":testmodels")) testImplementation(project(":testutils")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-api/build.gradle.kts b/aws-api/build.gradle.kts index 58a7852bdb..865c452960 100644 --- a/aws-api/build.gradle.kts +++ b/aws-api/build.gradle.kts @@ -69,3 +69,7 @@ dependencies { androidTestUtil(libs.test.androidx.orchestrator) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-auth-cognito/build.gradle.kts b/aws-auth-cognito/build.gradle.kts index 0a0a7e1496..83122a8028 100644 --- a/aws-auth-cognito/build.gradle.kts +++ b/aws-auth-cognito/build.gradle.kts @@ -67,3 +67,7 @@ dependencies { androidTestImplementation(project(":aws-api")) androidTestImplementation(project(":testutils")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-auth-cognito/src/test/java/featureTest/utilities/APICaptorFactory.kt b/aws-auth-cognito/src/test/java/featureTest/utilities/APICaptorFactory.kt index 8fd7d2c25f..ff8d2d9f1d 100644 --- a/aws-auth-cognito/src/test/java/featureTest/utilities/APICaptorFactory.kt +++ b/aws-auth-cognito/src/test/java/featureTest/utilities/APICaptorFactory.kt @@ -60,7 +60,6 @@ class APICaptorFactory( val errorCaptor = slot() val actionCaptor = slot>().apply { captured = emptyMap() - isCaptured = true } } diff --git a/aws-auth-plugins-core/build.gradle.kts b/aws-auth-plugins-core/build.gradle.kts index 5c5a568869..3647004ae6 100644 --- a/aws-auth-plugins-core/build.gradle.kts +++ b/aws-auth-plugins-core/build.gradle.kts @@ -24,6 +24,12 @@ apply(from = rootProject.file("configuration/publishing.gradle")) group = properties["POM_GROUP"].toString() +android { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } +} + dependencies { implementation(project(":core")) implementation(project(":aws-core")) diff --git a/aws-datastore/build.gradle.kts b/aws-datastore/build.gradle.kts index b7625cbb34..7a81ce2fd0 100644 --- a/aws-datastore/build.gradle.kts +++ b/aws-datastore/build.gradle.kts @@ -58,5 +58,5 @@ dependencies { } afterEvaluate { - android.kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString() + android.kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString() } diff --git a/aws-datastore/src/test/java/com/amplifyframework/datastore/storage/sqlite/SQLCommandProcessorTest.java b/aws-datastore/src/test/java/com/amplifyframework/datastore/storage/sqlite/SQLCommandProcessorTest.java index 251edfd5d1..3e4a973c42 100644 --- a/aws-datastore/src/test/java/com/amplifyframework/datastore/storage/sqlite/SQLCommandProcessorTest.java +++ b/aws-datastore/src/test/java/com/amplifyframework/datastore/storage/sqlite/SQLCommandProcessorTest.java @@ -116,7 +116,12 @@ public void rawQueryReturnsResults() throws AmplifyException { // Query for all BlogOwners, and verify that there is one result. SqlCommand queryCommand = sqlCommandFactory.queryFor(blogOwnerSchema, Where.matchesAll()); - Cursor cursor = sqlCommandProcessor.rawQuery(queryCommand); + Cursor cursor = null; + try { + cursor = sqlCommandProcessor.rawQuery(queryCommand); + } catch (Exception exc) { + throw new AmplifyException("DB already closed", exc, "Wait until DB is reopened"); + } List results = new ArrayList<>(); SQLiteModelFieldTypeConverter converter = new SQLiteModelFieldTypeConverter(blogOwnerSchema, diff --git a/aws-geo-location/build.gradle.kts b/aws-geo-location/build.gradle.kts index 0f1e7b251e..a8d67b2ecf 100644 --- a/aws-geo-location/build.gradle.kts +++ b/aws-geo-location/build.gradle.kts @@ -40,5 +40,5 @@ dependencies { } afterEvaluate { - android.kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString() + android.kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString() } diff --git a/aws-logging-cloudwatch/build.gradle.kts b/aws-logging-cloudwatch/build.gradle.kts index d2295f9169..f843a48324 100644 --- a/aws-logging-cloudwatch/build.gradle.kts +++ b/aws-logging-cloudwatch/build.gradle.kts @@ -47,3 +47,7 @@ dependencies { testImplementation(libs.test.androidx.workmanager) testImplementation(project(":aws-logging-cloudwatch")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-logging-cloudwatch/src/test/kotlin/com/amplifyframework/logging/cloudwatch/AWSCloudWatchLoggingPluginImplementationTest.kt b/aws-logging-cloudwatch/src/test/kotlin/com/amplifyframework/logging/cloudwatch/AWSCloudWatchLoggingPluginImplementationTest.kt index ba3311fbd4..4f5e4324bd 100644 --- a/aws-logging-cloudwatch/src/test/kotlin/com/amplifyframework/logging/cloudwatch/AWSCloudWatchLoggingPluginImplementationTest.kt +++ b/aws-logging-cloudwatch/src/test/kotlin/com/amplifyframework/logging/cloudwatch/AWSCloudWatchLoggingPluginImplementationTest.kt @@ -60,8 +60,8 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { region = "REGION", logGroupName = "LOG_GROUP" ) - every { loggingConstraintsResolver::localLoggingConstraint.set(capture(loggingConstraintsSlot)) }.answers { } - coEvery { cloudWatchLogManager.startSync() }.answers { } + every { loggingConstraintsResolver::localLoggingConstraint.set(capture(loggingConstraintsSlot)) } returns Unit + coEvery { cloudWatchLogManager.startSync() } returns Unit awsCloudWatchLoggingPluginImplementation.configure( awsLoggingConfig ) @@ -77,8 +77,8 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { region = "REGION", logGroupName = "LOG_GROUP" ) - every { loggingConstraintsResolver::localLoggingConstraint.set(any()) }.answers { } - coEvery { cloudWatchLogManager.startSync() }.answers { } + every { loggingConstraintsResolver::localLoggingConstraint.set(any()) } returns Unit + coEvery { cloudWatchLogManager.startSync() } returns Unit awsCloudWatchLoggingPluginImplementation.configure( awsLoggingConfig ) @@ -88,7 +88,7 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { @Test fun `on enable`() = runTest { - coEvery { cloudWatchLogManager.startSync() }.answers { } + coEvery { cloudWatchLogManager.startSync() } returns Unit awsCloudWatchLoggingPluginImplementation.enable() assertTrue(awsCloudWatchLoggingPluginImplementation.isPluginEnabled) coVerify(exactly = 1) { cloudWatchLogManager.startSync() } @@ -96,7 +96,7 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { @Test fun `on disable`() { - every { cloudWatchLogManager.stopSync() }.answers { } + every { cloudWatchLogManager.stopSync() } returns Unit awsCloudWatchLoggingPluginImplementation.disable() assertFalse(awsCloudWatchLoggingPluginImplementation.isPluginEnabled) verify(exactly = 1) { cloudWatchLogManager.stopSync() } @@ -106,8 +106,8 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { fun `on flush logs success`() = runTest { val onSuccess = mockk() val onError = mockk>() - coEvery { cloudWatchLogManager.syncLogEventsWithCloudwatch() }.answers { } - every { onSuccess.call() }.answers { } + coEvery { cloudWatchLogManager.syncLogEventsWithCloudwatch() } returns Unit + every { onSuccess.call() } returns Unit awsCloudWatchLoggingPluginImplementation.flushLogs(onSuccess, onError) coVerify(exactly = 1) { cloudWatchLogManager.syncLogEventsWithCloudwatch() } verify(exactly = 1) { onSuccess.call() } @@ -120,7 +120,7 @@ internal class AWSCloudWatchLoggingPluginImplementationTest { val onError = mockk>() val exception = slot() coEvery { cloudWatchLogManager.syncLogEventsWithCloudwatch() }.throws(IllegalStateException()) - every { onError.accept(capture(exception)) }.answers { } + every { onError.accept(capture(exception)) } returns Unit awsCloudWatchLoggingPluginImplementation.flushLogs(onSuccess, onError) coVerify(exactly = 1) { cloudWatchLogManager.syncLogEventsWithCloudwatch() } verify(exactly = 0) { onSuccess.call() } diff --git a/aws-pinpoint-core/build.gradle.kts b/aws-pinpoint-core/build.gradle.kts index a35762d90e..3e8ba22d34 100644 --- a/aws-pinpoint-core/build.gradle.kts +++ b/aws-pinpoint-core/build.gradle.kts @@ -44,3 +44,7 @@ dependencies { androidTestImplementation(libs.test.androidx.runner) androidTestImplementation(libs.test.androidx.junit) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-pinpoint-core/src/test/java/com/amplifyframework/pinpoint/core/AnalyticsClientTest.kt b/aws-pinpoint-core/src/test/java/com/amplifyframework/pinpoint/core/AnalyticsClientTest.kt index 5c8c6b96cf..f25ee42548 100644 --- a/aws-pinpoint-core/src/test/java/com/amplifyframework/pinpoint/core/AnalyticsClientTest.kt +++ b/aws-pinpoint-core/src/test/java/com/amplifyframework/pinpoint/core/AnalyticsClientTest.kt @@ -35,6 +35,7 @@ import java.util.UUID import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest +import org.junit.After import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test @@ -60,8 +61,8 @@ class AnalyticsClientTest { fun setup() = runTest { mockkStatic("com.amplifyframework.pinpoint.core.util.SharedPreferencesUtilKt") every { sharedPrefs.getUniqueId() } answers { "UNIQUE_ID" } - coEvery { sessionClient.setAnalyticsClient(any()) } answers { } - coEvery { sessionClient.startSession() } answers { } + coEvery { sessionClient.setAnalyticsClient(any()) } returns Unit + coEvery { sessionClient.startSession() } returns Unit analyticsClient = AnalyticsClient( ApplicationProvider.getApplicationContext(), @@ -159,4 +160,9 @@ class AnalyticsClientTest { analyticsClient.addGlobalMetric(metricName, metricValue) assertEquals(metricValue, analyticsClient.getGlobalMetrics()[metricName]) } + + @After + fun tearDown() { + analyticsClient.disableEventSubmitter() + } } diff --git a/aws-predictions/build.gradle.kts b/aws-predictions/build.gradle.kts index 9db0c3a5e9..d84b354544 100644 --- a/aws-predictions/build.gradle.kts +++ b/aws-predictions/build.gradle.kts @@ -51,3 +51,7 @@ dependencies { androidTestImplementation(libs.test.mockk.android) androidTestImplementation(libs.rxjava) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/aws-push-notifications-pinpoint-common/build.gradle.kts b/aws-push-notifications-pinpoint-common/build.gradle.kts index 04a9ccbbbb..7baeca672c 100644 --- a/aws-push-notifications-pinpoint-common/build.gradle.kts +++ b/aws-push-notifications-pinpoint-common/build.gradle.kts @@ -23,6 +23,12 @@ apply(from = rootProject.file("configuration/publishing.gradle")) group = properties["POM_GROUP"].toString() +android { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } +} + dependencies { implementation(project(":annotations")) api(project(":common-core")) diff --git a/aws-storage-s3/build.gradle.kts b/aws-storage-s3/build.gradle.kts index a1960c0578..84aa231961 100644 --- a/aws-storage-s3/build.gradle.kts +++ b/aws-storage-s3/build.gradle.kts @@ -52,3 +52,7 @@ dependencies { androidTestImplementation(libs.test.androidx.workmanager) androidTestImplementation(project(":aws-storage-s3")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/build.gradle.kts b/build.gradle.kts index 58e401444b..a111ec04d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -156,15 +156,15 @@ fun Project.configureAndroid() { compileOptions { isCoreLibraryDesugaringEnabled = true - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } // Needed when running integration tests. The oauth2 library uses relies on two // dependencies (Apache's httpcore and httpclient), both of which include // META-INF/DEPENDENCIES. Tried a couple other options to no avail. packagingOptions { - resources.excludes.add("META-INF/DEPENDENCIES") + resources.excludes.add("META-INF/*") } } diff --git a/canaries/example/app/build.gradle b/canaries/example/app/build.gradle index 0ca33b10f7..7982e131f9 100644 --- a/canaries/example/app/build.gradle +++ b/canaries/example/app/build.gradle @@ -24,8 +24,8 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = '1.8' diff --git a/core-kotlin/build.gradle.kts b/core-kotlin/build.gradle.kts index 8d431fbcd4..d835cecf41 100644 --- a/core-kotlin/build.gradle.kts +++ b/core-kotlin/build.gradle.kts @@ -36,6 +36,6 @@ dependencies { } android.kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index c749fdd5a9..71b15db6ff 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -64,6 +64,10 @@ dependencies { androidTestImplementation(libs.test.androidx.fragment) } +android.kotlinOptions { + jvmTarget = "11" +} + afterEvaluate { // Disables this warning: // warning: listOf(classfile) MethodParameters attribute diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 46a1474009..75b28eb8a4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ maplibre-annotations = "1.0.0" material = "1.8.0" mockito = "3.9.0" mockito-inline = "3.11.2" -mockk = "1.12.3" +mockk = "1.13.8" mockwebserver = "5.0.0-alpha.11" navigation = "2.3.4" oauth2 = "0.26.0" diff --git a/maplibre-adapter/build.gradle.kts b/maplibre-adapter/build.gradle.kts index 84888a2557..b642a6f74c 100644 --- a/maplibre-adapter/build.gradle.kts +++ b/maplibre-adapter/build.gradle.kts @@ -25,7 +25,7 @@ group = properties["POM_GROUP"].toString() android { kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() + jvmTarget = JavaVersion.VERSION_11.toString() } lint { disable += "GradleDependency" diff --git a/rxbindings/build.gradle.kts b/rxbindings/build.gradle.kts index c4eab1dc52..ef01c593cf 100644 --- a/rxbindings/build.gradle.kts +++ b/rxbindings/build.gradle.kts @@ -38,3 +38,7 @@ dependencies { testImplementation(libs.test.robolectric) testImplementation(project(":rxbindings")) } + +android.kotlinOptions { + jvmTarget = "11" +} diff --git a/rxbindings/src/test/java/com/amplifyframework/rx/RxStorageBindingTest.java b/rxbindings/src/test/java/com/amplifyframework/rx/RxStorageBindingTest.java index 4e014268da..eda1755bf1 100644 --- a/rxbindings/src/test/java/com/amplifyframework/rx/RxStorageBindingTest.java +++ b/rxbindings/src/test/java/com/amplifyframework/rx/RxStorageBindingTest.java @@ -81,7 +81,7 @@ */ @RunWith(RobolectricTestRunner.class) public final class RxStorageBindingTest { - private static final long TIMEOUT_MS = TimeUnit.SECONDS.toMillis(5); + private static final long TIMEOUT_MS = TimeUnit.SECONDS.toMillis(10); private RxStorageCategoryBehavior rxStorage; private StoragePlugin delegate; private File localFile;