I must upgrade a project written in flutter to compileSdkVersion 33 Since i upgraded, the app crahes at least in simulator. A new flutter project whith compileSdkVersion 33 make no problems, but i can't find the differences in gradle.build files or android manifest.
Any ideas?
Flutter Version:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.5, on macOS 12.6 21G115 darwin-arm, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.2)
[✓] VS Code (version 1.72.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Error:
D/FlutterLocationService(13862): Binding to location service.
E/AndroidRuntime(13862): FATAL EXCEPTION: main
E/AndroidRuntime(13862): Process: de.roegmbh.checkit, PID: 13862
E/AndroidRuntime(13862): java.lang.NoSuchMethodError: No interface method addWindowLayoutInfoListener(Landroid/app/Activity;Lj$/util/function/Consumer;)V in class Landroidx/window/extensions/layout/WindowLayoutComponent; or its super classes (declaration of 'androidx.window.extensions.layout.WindowLayoutComponent' appears in /system_ext/framework/androidx.window.extensions.jar)
E/AndroidRuntime(13862): at androidx.window.layout.ExtensionWindowLayoutInfoBackend.registerLayoutChangeCallback(ExtensionWindowLayoutInfoBackend.kt:68)
E/AndroidRuntime(13862): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(WindowInfoTrackerImpl.kt:52)
E/AndroidRuntime(13862): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:8)
E/AndroidRuntime(13862): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:4)
E/AndroidRuntime(13862): at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
E/AndroidRuntime(13862): at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
E/AndroidRuntime(13862): at androidx.window.java.layout.WindowInfoTrackerCallbackAdapter$addListener$1$1.invokeSuspend(WindowInfoTrackerCallbackAdapter.kt:96)
E/AndroidRuntime(13862): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime(13862): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
E/AndroidRuntime(13862): at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime(13862): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(13862): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(13862): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(13862): at android.app.ActivityThread.main(ActivityThread.java:7898)
E/AndroidRuntime(13862): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(13862): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(13862): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Try adding the following dependencies in the android/app/build.gradle file:
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
This is in Groovy. If you are using Kotlin, write add these dependencies with the appropriate syntax.
I faced this issue when I added desugaring required for flutter_local_notifications package. I was running an android emulator with the following configuration (android/app/build.gradle):
minSdkVersion 22
compileSdkVersion 33
targetSdkVersion 33
My gradle version is 7.5.1, and my android gradle plugin version is 7.3.1. Therefore, I used desugar_jdk_libs version 1.2.2 to support targetSdkVersion 33.
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
minSdkVersion is 22, so multidex is enabled by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With