diff --git a/add_to_app/android_view/android_view/app/build.gradle b/add_to_app/android_view/android_view/app/build.gradle
index cf40f5d0c97..7977fae8905 100644
--- a/add_to_app/android_view/android_view/app/build.gradle
+++ b/add_to_app/android_view/android_view/app/build.gradle
@@ -4,12 +4,16 @@ plugins {
}
android {
- compileSdkVersion 31
+ compileSdk 34
+
+ lint {
+ baseline = file("lint-baseline.xml")
+ }
defaultConfig {
applicationId "dev.flutter.example.androidView"
- minSdkVersion 16
- targetSdkVersion 30
+ minSdkVersion 21
+ targetSdkVersion 34
versionCode 1
versionName "1.0"
@@ -32,11 +36,12 @@ android {
buildFeatures {
viewBinding true
}
+ namespace 'dev.flutter.example.androidView'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'androidx.core:core-ktx:1.3.2'
+ implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
diff --git a/add_to_app/android_view/android_view/app/lint-baseline.xml b/add_to_app/android_view/android_view/app/lint-baseline.xml
new file mode 100644
index 00000000000..18092041fe1
--- /dev/null
+++ b/add_to_app/android_view/android_view/app/lint-baseline.xml
@@ -0,0 +1,279 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml b/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml
index 919153dccc1..920589d73ae 100644
--- a/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml
+++ b/add_to_app/android_view/android_view/app/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+
diff --git a/add_to_app/android_view/android_view/app/src/main/java/dev/flutter/example/androidView/MainActivity.kt b/add_to_app/android_view/android_view/app/src/main/java/dev/flutter/example/androidView/MainActivity.kt
index 9398eae56f5..5367a605659 100644
--- a/add_to_app/android_view/android_view/app/src/main/java/dev/flutter/example/androidView/MainActivity.kt
+++ b/add_to_app/android_view/android_view/app/src/main/java/dev/flutter/example/androidView/MainActivity.kt
@@ -8,6 +8,7 @@ import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.os.BundleCompat
import androidx.recyclerview.widget.LinearLayoutManager
import dev.flutter.example.androidView.databinding.ActivityMainBinding
import io.flutter.FlutterInjector
@@ -61,7 +62,14 @@ class MainActivity : AppCompatActivity() {
// If the activity was restarted, keep track of the previous scroll
// position and of the previous cell indices that were randomly selected
// as Flutter cells to preserve immersion.
- layoutManager.onRestoreInstanceState(savedInstanceState?.getParcelable("layoutManager"))
+ if (savedInstanceState != null) {
+ val state = BundleCompat.getParcelable(
+ savedInstanceState,
+ "layoutManager",
+ Parcelable::class.java
+ )
+ layoutManager.onRestoreInstanceState(state)
+ }
val previousFlutterCellsArray = savedInstanceState?.getIntegerArrayList("adapter")
if (previousFlutterCellsArray != null) {
adapter.previousFlutterCells = TreeSet(previousFlutterCellsArray)
diff --git a/add_to_app/android_view/android_view/build.gradle b/add_to_app/android_view/android_view/build.gradle
index 00b68e4491e..f6f55b6614e 100644
--- a/add_to_app/android_view/android_view/build.gradle
+++ b/add_to_app/android_view/android_view/build.gradle
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = "1.6.0"
+ ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:8.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
diff --git a/add_to_app/android_view/android_view/gradle.properties b/add_to_app/android_view/android_view/gradle.properties
index 252175276f7..c8ce6fbcce6 100644
--- a/add_to_app/android_view/android_view/gradle.properties
+++ b/add_to_app/android_view/android_view/gradle.properties
@@ -16,4 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
-kotlin.code.style=official
\ No newline at end of file
+kotlin.code.style=official
+android.nonTransitiveRClass=false
+android.nonFinalResIds=false
\ No newline at end of file
diff --git a/add_to_app/android_view/android_view/gradle/wrapper/gradle-wrapper.properties b/add_to_app/android_view/android_view/gradle/wrapper/gradle-wrapper.properties
index ee67d29dcc9..17655d0ef2b 100644
--- a/add_to_app/android_view/android_view/gradle/wrapper/gradle-wrapper.properties
+++ b/add_to_app/android_view/android_view/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Mar 10 09:46:16 PST 2021
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart b/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart
index 59e3c7b7120..1991992686e 100644
--- a/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart
+++ b/add_to_app/android_view/flutter_module_using_plugin/lib/cell.dart
@@ -6,7 +6,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:sensors/sensors.dart';
+import 'package:sensors_plus/sensors_plus.dart';
// This is on alternate entrypoint for this module to display Flutter UI in
// a (multi-)view integration scenario.
@@ -109,7 +109,7 @@ class _CellState extends State with WidgetsBindingObserver {
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
- ? accelerometerEvents
+ ? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {
diff --git a/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml b/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml
index 9953baaca63..7ea5799bb22 100644
--- a/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml
+++ b/add_to_app/android_view/flutter_module_using_plugin/pubspec.yaml
@@ -10,8 +10,8 @@ dependencies:
flutter:
sdk: flutter
provider: ^6.0.2
- url_launcher: ^6.0.6
- sensors: ^2.0.3
+ url_launcher: ^6.0.20
+ sensors_plus: ^5.0.1
dev_dependencies:
analysis_defaults:
diff --git a/add_to_app/plugin/android_using_plugin/app/build.gradle b/add_to_app/plugin/android_using_plugin/app/build.gradle
index 941b8bb4f44..546c701bbc5 100644
--- a/add_to_app/plugin/android_using_plugin/app/build.gradle
+++ b/add_to_app/plugin/android_using_plugin/app/build.gradle
@@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 33
+ compileSdk 34
defaultConfig {
applicationId "dev.flutter.example.androidusingplugin"
- minSdkVersion 19
- targetSdkVersion 33
+ minSdkVersion 21
+ targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -17,19 +17,29 @@ android {
minifyEnabled false
}
}
+ // Remove when #flutter/flutter/issues/150955 is merged to stable.
+ lintOptions {
+ checkReleaseBuilds false
+ }
+ // Keep java and kotlin versions in sync.
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ namespace 'dev.flutter.example.androidusingplugin'
}
dependencies {
implementation project(':flutter')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'androidx.core:core-ktx:1.10.1'
+ implementation 'androidx.appcompat:appcompat:1.7.0'
+ implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation 'androidx.test.ext:junit:1.2.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
diff --git a/add_to_app/plugin/android_using_plugin/app/src/main/AndroidManifest.xml b/add_to_app/plugin/android_using_plugin/app/src/main/AndroidManifest.xml
index 8766e128d21..f0161e6a897 100644
--- a/add_to_app/plugin/android_using_plugin/app/src/main/AndroidManifest.xml
+++ b/add_to_app/plugin/android_using_plugin/app/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+
with WidgetsBindingObserver {
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
- ? accelerometerEvents
+ ? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {
diff --git a/add_to_app/plugin/flutter_module_using_plugin/pubspec.yaml b/add_to_app/plugin/flutter_module_using_plugin/pubspec.yaml
index 201d1f21896..7ea5799bb22 100644
--- a/add_to_app/plugin/flutter_module_using_plugin/pubspec.yaml
+++ b/add_to_app/plugin/flutter_module_using_plugin/pubspec.yaml
@@ -11,7 +11,7 @@ dependencies:
sdk: flutter
provider: ^6.0.2
url_launcher: ^6.0.20
- sensors: ^2.0.3
+ sensors_plus: ^5.0.1
dev_dependencies:
analysis_defaults:
|