Skip to content

Commit 8e68e68

Browse files
Merge branch '127-fix-examples-android-studio-ladybug' into 'main'
Make demos compatible with Flutter SDK 3.24, JDK 21 #127 See merge request objectbox/objectbox-dart!97
2 parents 25bad72 + 69dc5eb commit 8e68e68

File tree

156 files changed

+1967
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1967
-457
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
# Can not use env variables here, only within 'steps'.
6969
# For available versions see https://dart.dev/get-dart/archive
7070
- 3.7.2
71-
- 2.18.6 # Use latest bugfix release to get tooling fixes
71+
- 3.5.4 # Use latest bugfix release to get tooling fixes
7272
runs-on: ${{ matrix.os }}
7373
steps:
7474
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 # v1.6.5
@@ -110,20 +110,31 @@ jobs:
110110
# Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new SDKs.
111111
# Can not use env variables here, only within 'steps'.
112112
# For available versions see https://docs.flutter.dev/release/archive
113+
# NOTE Also update versions for Ubuntu below!
113114
- 3.29.2
114-
- 3.7.12 # Use latest bugfix release to get tooling fixes
115+
- 3.24.5 # Use latest bugfix release to get tooling fixes
116+
include:
117+
# Test building for Android with highest supported JDK on latest Flutter SDK,
118+
# lowest supported JDK on lowest supported Flutter SDK. (Android is only built if a Linux
119+
# OS is detected, see integration-test.sh)
120+
- os: ubuntu-24.04
121+
flutter-version: 3.29.2
122+
jdk: 21
123+
- os: ubuntu-24.04
124+
flutter-version: 3.24.5 # Use latest bugfix release to get tooling fixes
125+
jdk: 17
115126
runs-on: ${{ matrix.os }}
116127
steps:
117128
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
118129
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
119130
with:
120131
flutter-version: ${{ matrix.flutter-version }}
121132
cache: true
122-
# windows-2022 defaults to Java 8, but Android Plugin requires at least 11.
123-
- uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
133+
- if: ${{ matrix.jdk }}
134+
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
124135
with:
125136
distribution: 'temurin'
126-
java-version: '17'
137+
java-version: ${{ matrix.jdk }}
127138
- run: echo $PATH
128139
- run: flutter --version
129140
# https://docs.flutter.dev/desktop#additional-linux-requirements

.gitlab-ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ stages:
66
variables:
77
# Test latest available and lowest supported SDK (see dev-doc/updating-dart-flutter-and-dependencies.md).
88
# # Pick a concrete version instead of "latest" to avoid builds breaking due to changes in new
9-
# SDKs. For available versions see https://hub.docker.com/_/dart?tab=tags
9+
# SDKs.
10+
# For available versions see https://hub.docker.com/_/dart/tags and https://dart.dev/get-dart/archive
1011
DART_VERSION_LATEST: '3.7.2'
11-
DART_VERSION_LOWEST: '2.18.6' # Use latest bugfix release to get tooling fixes
12+
DART_VERSION_LOWEST: '3.5.4' # Use latest bugfix release to get tooling fixes
1213
DART_VERSION: $DART_VERSION_LATEST # Also used for caching, see .cache template
1314

1415
.common:

dev-doc/updating-examples.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
# Updating Flutter examples
22

3-
First, make sure to switch your Flutter SDK to the lowest version the ObjectBox packages support
4-
(see pubspec.yaml files).
3+
First, make sure to switch your Flutter SDK to the lowest version that should be supported
4+
(at minimum what the Flutter packages require, see their pubspec.yaml files; but typically higher
5+
due to dependency or tooling requirements):
56

6-
Then, in the example directory delete the platform-specific directories.
7+
```shell
8+
# Make sure to close IDEs or tools using the Flutter or Dart SDK first.
9+
# Then, in the Flutter SDK directory:
10+
git checkout 3.16.9
11+
flutter doctor
12+
```
713

8-
Then, run `flutter create --platforms=android,ios,linux,macos,windows .` to re-create these files.
14+
Then, for an example in its directory delete the platform-specific directories and the
915

10-
Then, remove the created default test files and manually review the changes and commit what's necessary.
16+
- `.gitignore`
17+
- `analysis_options.yaml`
18+
- `pubspec.yaml`
1119

12-
Check changes do not break the example in any way, make additional changes as required.
20+
files.
1321

14-
Compare against a clean Flutter template (run `create` in an empty folder) to see if updates to
15-
other files like pubspec.yaml are needed.
22+
Then, run `flutter create --platforms=android,ios,linux,macos,windows .` to create empty example
23+
files.
24+
25+
Then, remove the created default widget test file. Review the changes, restore any required changes
26+
(like in Podfile, build scripts, project files, the files mentioned above...). This can be helped by
27+
running `flutter pub upgrade` and `flutter run` on each platform (with the same Flutter SDK version!).
28+
29+
Then, commit only what's necessary.
30+
31+
Then, adjust the other examples accordingly.

objectbox/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## latest
22

3-
3+
* Examples: demos are compatible with JDK 21 included with Android Studio Ladybug or later, require
4+
Flutter SDK 3.24 (with Dart SDK 3.5) or newer.
45

56
## 4.1.0 (2025-02-04)
67

objectbox/example/flutter/objectbox_demo/.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@ migrate_working_dir/
2727
.dart_tool/
2828
.flutter-plugins
2929
.flutter-plugins-dependencies
30-
.packages
3130
.pub-cache/
3231
.pub/
3332
/build/
3433

35-
# Web related
36-
lib/generated_plugin_registrant.dart
37-
3834
# Symbolication related
3935
app.*.symbols
4036

@@ -46,8 +42,6 @@ app.*.map.json
4642
/android/app/profile
4743
/android/app/release
4844

49-
objectbox
50-
5145
# Not checking in Podfile.lock to avoid updating it for every
5246
# ObjectBox release and to always build with latest dependencies on CI.
5347
ios/Podfile.lock

objectbox/example/flutter/objectbox_demo/.metadata

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 135454af32477f815a7525073027a3ff9eff1bfd
8-
channel: unknown
7+
revision: "41456452f29d64e8deb623a3c927524bcf9f111b"
8+
channel: "[user-branch]"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
16+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
17+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
1818
- platform: android
19-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
19+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
20+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
2121
- platform: ios
22-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
23-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
22+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
23+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
2424
- platform: linux
25-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
26-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
25+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
26+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
2727
- platform: macos
28-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
29-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
28+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
29+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
3030
- platform: windows
31-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
32-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
31+
create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
32+
base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b
3333

3434
# User provided section
3535

objectbox/example/flutter/objectbox_demo/analysis_options.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ linter:
1313
# The lint rules applied to this project can be customized in the
1414
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
1515
# included above or to enable additional rules. A list of all available lints
16-
# and their documentation is published at
17-
# https://dart-lang.github.io/linter/lints/index.html.
16+
# and their documentation is published at https://dart.dev/lints.
1817
#
1918
# Instead of disabling a lint rule for the entire project in the
2019
# section below, it can also be suppressed for a single line of code

objectbox/example/flutter/objectbox_demo/android/app/build.gradle

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,13 +22,16 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
26+
namespace "com.example.objectbox_demo"
2927
compileSdkVersion flutter.compileSdkVersion
30-
ndkVersion flutter.ndkVersion
28+
// ObjectBox: Flutter defaults to NDK 23.1.7779620, but
29+
// - objectbox_flutter_libs requires Android NDK 25.1.8937393
30+
// - path_provider_android requires Android NDK 25.1.8937393
31+
// Until Flutter uses a newer version (https://github.com/flutter/flutter/commit/919bed6e0a18bd5b76fb581ede10121f8c14a6f7)
32+
// manually set the required one:
33+
// ndkVersion flutter.ndkVersion
34+
ndkVersion = "25.1.8937393"
3135

3236
compileOptions {
3337
sourceCompatibility JavaVersion.VERSION_1_8
@@ -46,8 +50,7 @@ android {
4650
applicationId "com.example.objectbox_demo"
4751
// You can update the following values to match your application needs.
4852
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
49-
// minSdkVersion flutter.minSdkVersion
50-
minSdkVersion 21 // ObjectBox Android requires Android 5.0 (API level 21)
53+
minSdkVersion flutter.minSdkVersion
5154
targetSdkVersion flutter.targetSdkVersion
5255
versionCode flutterVersionCode.toInteger()
5356
versionName flutterVersionName
@@ -67,5 +70,4 @@ flutter {
6770
}
6871

6972
dependencies {
70-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
7173
}

objectbox/example/flutter/objectbox_demo/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.objectbox_demo">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
<!-- The INTERNET permission is required for development. Specifically,
43
the Flutter tool needs it to communicate with the running application
54
to allow setting breakpoints, to provide hot reload, etc.

objectbox/example/flutter/objectbox_demo/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.objectbox_demo">
3-
<application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<application
43
android:label="objectbox_demo"
54
android:name="${applicationName}"
65
android:icon="@mipmap/ic_launcher">

0 commit comments

Comments
 (0)