Skip to content

Commit

Permalink
feat(android): Bump Next version dependencies, min and target SDK (#949)
Browse files Browse the repository at this point in the history
* bump kotlin, coroutines, room

* update docs
  • Loading branch information
krizzu committed Mar 27, 2023
1 parent 02477f1 commit 271a040
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 40 deletions.
20 changes: 8 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,14 @@ buildscript {
? rootProject.ext['kotlinVersion']
: rootProject.hasProperty('AsyncStorage_kotlinVersion')
? rootProject.properties['AsyncStorage_kotlinVersion']
: '1.6.10'
: '1.8.10'

repositories {
mavenCentral()
google()
}
dependencies {
def projectExampleDir = Paths.get(project.projectDir.getParent(), "example", "android").toString()
def rootProjectDir = rootProject.projectDir.getPath()
if (projectExampleDir == rootProjectDir) {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion"
}
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion"
}
}

Expand Down Expand Up @@ -78,10 +74,10 @@ if (useNextStorage) {
}

android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
compileSdkVersion safeExtGet('compileSdkVersion', 32)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
minSdkVersion safeExtGet('minSdkVersion', 23)
targetSdkVersion safeExtGet('targetSdkVersion', 32)
buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L"
buildConfigField "boolean", "AsyncStorage_useDedicatedExecutor", "${useDedicatedExecutor}"
buildConfigField "boolean", "AsyncStorage_useNextStorage", "${useNextStorage}"
Expand Down Expand Up @@ -112,9 +108,9 @@ repositories {
dependencies {

if (useNextStorage) {
def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.2')
def coroutines_version = "1.6.0"
def coroutinesTest_version = "1.6.0"
def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.3')
def coroutines_version = "1.6.4"
def coroutinesTest_version = "1.6.4"
// if we don't provide explicit dependency on reflection, kotlin plugin
// would add one automatically, probably a version that is not compatible with
// used kotlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private object MIGRATION_TO_NEXT : Migration(1, 2) {
}
}

@Database(entities = [Entry::class], version = DATABASE_VERSION, exportSchema = true)
@Database(entities = [Entry::class], version = DATABASE_VERSION, exportSchema = false)
internal abstract class StorageDb : RoomDatabase() {
abstract fun storage(): StorageDao

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android.enableJetifier=true
#ANDROID_NDK_VERSION=21.4.7075529

# Version of Kotlin to build against.
KOTLIN_VERSION=1.6.21
KOTLIN_VERSION=1.8.10

# This is an example of how you can change default DB size (6MB) to 10MB
#AsyncStorage_db_size_in_MB=10
Expand Down
32 changes: 6 additions & 26 deletions website/docs/advanced/Next.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,7 @@ When you enable the feature again, the new database is **not** recreated, becaus

### Enable

See [Configuration](#configuration) section below to learn more about setting different versions of Kotlin or Room.

1. In your project's `android` directory, locate root `build.gradle` file. Add Kotlin dependency to the `buildscript`:

```diff
buildscript {
ext {
// other extensions
+ kotlinVersion = '1.6.10'
}

dependencies {
// other dependencies
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

```

2. In the same directory (normally `android`) locate `gradle.properties` file (if it does not exist, create one) and add the line:

In your project's `android` directory, locate `gradle.properties` file (if it does not exist, create one) and add the line:
```groovy
AsyncStorage_useNextStorage=true
```
Expand All @@ -67,28 +47,28 @@ AsyncStorage_useNextStorage=true

**Kotlin version**

Next storage is tested against Kotlin version `1.6.10`.
Next storage is tested against Kotlin version `1.8.10`.
You can specify different version, in one of two ways:

- add `kotlinVersion` extension to the `rootProject`:

```groovy
rootProject.ext.kotlinVersion = '1.6.10'
rootProject.ext.kotlinVersion = '1.8.10'
```

- specify `AsyncStorage_kotlinVersion` in `gradle.properties`:

```groovy
AsyncStorage_kotlinVersion=1.6.10
AsyncStorage_kotlinVersion=1.8.10
```

**Room**

Next AsyncStorage uses [Room persistence library](https://developer.android.com/jetpack/androidx/releases/room) to store data.
Currently, tested version is `2.4.2`. You can specify different version, by adding a flag to `gradle.properties`:
Currently, tested version is `2.4.3`. You can specify different version, by adding a flag to `gradle.properties`:

```groovy
AsyncStorage_next_roomVersion=2.4.2
AsyncStorage_next_roomVersion=2.4.3
```

### Notable changes
Expand Down

0 comments on commit 271a040

Please sign in to comment.