Crash when running minified app on Android KitKat (API 19) with Android Gradle plugin 7.3
Steps to Reproduce
- Create a new default Flutter project
- change
/android/build.gradleto useclasspath 'com.android.tools.build:gradle:7.3.1' - change
/android/app/build.gradleto useminifyEnabled truein the appropriate build type. If you're running in debug:
buildTypes {
debug {
minifyEnabled true
}
}
- run on an API 19 device (
flutter run) or emulator (flutter run --enable-software-rendering)
Actual results:
The app crashes.
Logs
Logs are too verbose. Can't paste here.
flutter analyze
Analyzing flutter_crash_kk...
info • 'headline4' is deprecated and shouldn't be used. Use headlineMedium instead. This feature was deprecated after v3.1.0-0.0.pre. • lib/main.dart:103:50 • deprecated_member_use
1 issue found. (ran in 11.8s)
flutter doctor -v
[✓] Flutter (Channel master, 3.6.0-1.0.pre.16, on Ubuntu 22.10 5.19.0-23-generic, locale en_US.UTF-8)
• Flutter version 3.6.0-1.0.pre.16 on channel master at /home/tibo/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b31b9dc05f (41 minutes ago), 2022-11-10 13:12:10 -0500
• Engine revision 057c53a054
• Dart version 2.19.0 (build 2.19.0-382.0.dev)
• DevTools version 2.19.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/tibo/Android/Sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: /snap/android-studio/124/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /snap/android-studio/123/android-studio
• Flutter plugin version 70.2.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] Android Studio (version 2021.3)
• Android Studio at /snap/android-studio/124/android-studio
• Flutter plugin version 71.0.3
• Dart plugin version 213.7433
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 4.4.2 (API 19) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.10 5.19.0-23-generic
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Hi @deckerst
I tried with a new Flutter project with gradle:7.1.2 on Pixel API 19 and saw it can run normally. However, it crashed when changing to gradle:7.3.1.
Also, the issue doesn't happen on Pixel 3a, Android 12, API 32.
Crash logs
[ +37 ms] Fail to connect to service protocol: http://127.0.0.1:53624/vklJBcY4sHQ=/: HttpException: Connection closed before full header was received, uri =
http://127.0.0.1:53624/vklJBcY4sHQ=/ws
[ +3 ms] Error connecting to the service protocol: failed to connect to http://127.0.0.1:53624/vklJBcY4sHQ=/
[ +11 ms] "flutter run" took 52,371ms.
[ +12 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:713:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
Do you have a similar log? If not so, can you provide the output of flutter run -v in a text file and attach it here?
Logs from flutter run -v --enable-software-rendering on an API 19 emulator run with Android Studio Dolphin 2021.3.1:
flutter_115100_logs.txt
I don't have a real API 19 device at hand, and I can't get the logcat traces from this API 19 emulator, with the actual crash stack trace. However, this issue has been reported to me originally in https://github.com/deckerst/aves/issues/388, with some interesting logcat traces, especially this stack trace:
[11-09 23:53:58.829 12801:12801 E/AndroidRuntime]
FATAL EXCEPTION: main
Process: deckers.thibault.aves.profile, PID: 12801
java.lang.VerifyError: io/flutter/plugin/editing/TextInputPlugin
at io.flutter.embedding.android.FlutterView.attachToFlutterEngine(FlutterView.java:1159)
at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(FlutterActivityAndFragmentDelegate.java:337)
at io.flutter.embedding.android.FlutterActivity.createFlutterView(FlutterActivity.java:609)
at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:505)
at deckers.thibault.aves.MainActivity.onCreate(MainActivity.kt:59)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)
@deckerst Based on your log, it seems to be related to existing app (Android native). In my case, I was trying with the default Flutter (counter app) and it crashed as my above comment. Can you also try and confirm? If you also face the same log, please take a look at issue https://github.com/flutter/flutter/issues/81901 as a similar issue.
Your logs only show the flutter tooling failing to connect to the app. And it cannot connect because the app failed to launch from the very beginning, when the activity is created. This is true for my app as well as for the basic counter app.
The native failure cannot be seen from the flutter run logs. Only logcat will show it.
As I understand it, the cause of this early crash is that the minifying process from the Android Gradle plugin creates machine code incompatible with the Dalvik VM that is used on Android until KitKat/API19.
https://github.com/flutter/flutter/issues/81901 seems unrelated. The symptoms are different, and the likely cause too.
@deckerst I can see the same log when using adb logcat. The issue is reproducible on the latest stable and master channels.
Labeling this issue for further investigation from the team.
Crash logs (adb logcat)
E/AndroidRuntime( 4150): FATAL EXCEPTION: main
E/AndroidRuntime( 4150): Process: com.example.new_flutter_project338, PID: 4150
E/AndroidRuntime( 4150): java.lang.VerifyError: io/flutter/plugin/editing/TextInputPlugin
E/AndroidRuntime( 4150): at io.flutter.embedding.android.FlutterView.attachToFlutterEngine(FlutterView.java:1159)
E/AndroidRuntime( 4150): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(FlutterActivityAndFragmentDelegate.java:337)
E/AndroidRuntime( 4150): at io.flutter.embedding.android.FlutterActivity.createFlutterView(FlutterActivity.java:609)
E/AndroidRuntime( 4150): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:505)
E/AndroidRuntime( 4150): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 4150): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 4150): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
E/AndroidRuntime( 4150): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime( 4150): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 4150): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 4150): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 4150): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 4150): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 4150): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4150): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 4150): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 4150): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 4150): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1608): Force finishing activity com.example.new_flutter_project338/.MainActivity
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-x64, locale en-VN)
• Flutter version 3.3.8 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (23 hours ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 70.0.5
• Dart plugin version 222.4167.21
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.73.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 332079AF-E895-4685-910E-7B1E18B0C6B8 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A380 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
[!] Flutter (Channel master, 3.6.0-1.0.pre.29, on macOS 13.0 22A380 darwin-x64, locale en-VN)
• Flutter version 3.6.0-1.0.pre.29 on channel master at /Users/huynq/Documents/GitHub/flutter_master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c6561e60a5 (57 minutes ago), 2022-11-10 20:46:09 -0500
• Engine revision 53cfb94c5b
• Dart version 2.19.0 (build 2.19.0-383.0.dev)
• DevTools version 2.19.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 70.0.5
• Dart plugin version 222.4167.21
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.73.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A380 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
@camsim99 and I were able to reproduce this. The offending code appears to be protected though so I am not sure how it is being called. https://github.com/flutter/engine/blob/main/shell/platform/android/io/flutter/embedding/android/FlutterView.java#L390
upon further investigation we found that you get this error without minification enabled and only by updating to a more recent version of gradle and kotlin.
Last update for the evening. Running with android version 33 does seem to pass.
@reidbaker maybe we're not talking about the same bug, but my initial report was for a crash specifically depending on 3 conditions:
- API 19
- minified
- Android Gradle plugin 7.3
Anything else (API>19, or not minified, or AGP <7.3) works fine for me.
We were able to reproduce the issue with those conditions except it did not require minification.
On Tue, Nov 22, 2022, 5:57 PM Thibault Deckers @.***> wrote:
@reidbaker https://github.com/reidbaker maybe we're not talking about the same bug, but my initial report was for a crash specifically depending on 3 conditions:
- API 19
- minified
- Android Gradle plugin 7.3
Anything else (API>19, or not minified, or AGP <7.3) works fine for me.
— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/115100#issuecomment-1324343078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIDVLACI3GH6OQPGSZ523TWJVFVZANCNFSM6AAAAAAR44GFMY . You are receiving this because you were mentioned.Message ID: @.***>
I have the same problem in real API 16 when I set AGP to 7.3, if I use 7.2 there is no problem and the app runs perfectly. I am not applying minify options either.
This is the trace obtained with logcat when starting the application:
Log
I/[LGHome]EVENT( 664): [Launcher.java:4403:startActivityForResult()]start Activity for result: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xxx/io.flutter.embedding.android.FlutterActivity }
I/ActivityManager( 464): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.xxx/io.flutter.embedding.android.FlutterActivity u=0} from pid 664
I/[LGHome]EVENT( 664): [Launcher.java:2177:onPause()]onPause
I/ActivityManager( 464): Start proc com.xxx for activity com.xxx/io.flutter.embedding.android.FlutterActivity: pid=3134 uid=10082 gids={1028}
E/Trace ( 3134): error opening trace file: No such file or directory (2)
V/ActivityThread( 3134): Class path: /data/app/com.xxx-1.apk, JNI path: /data/data/com.xxx/lib
W/dalvikvm( 3134): VFY: unable to resolve virtual method 97: Landroid/app/Activity;.reportFullyDrawn ()V
W/dalvikvm( 3134): VFY: unable to resolve static field 31 (SRGB) in Landroid/graphics/ColorSpace$Named;
E/dalvikvm( 3134): Could not find class 'java.util.Locale$Builder', referenced from method io.flutter.embedding.engine.FlutterJNI.computePlatformResolvedLocale
W/dalvikvm( 3134): VFY: unable to resolve new-instance 1419 (Ljava/util/Locale$Builder;) in Lio/flutter/embedding/engine/FlutterJNI;
E/dalvikvm( 3134): Could not find class 'java.util.Locale$LanguageRange', referenced from method io.flutter.plugin.localization.LocalizationPlugin.resolveNativeLocale
W/dalvikvm( 3134): VFY: unable to resolve new-instance 1420 (Ljava/util/Locale$LanguageRange;) in Lio/flutter/plugin/localization/LocalizationPlugin;
D/skia ( 3134): [SkFontMgr Android Parser] '/system/etc/fonts.xml' could not be opened
D/skia ( 3134): [SkFontMgr Android Parser] '/vendor/etc/fallback_fonts.xml' could not be opened
I/Adreno200-EGL( 3134): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_REL_2.0.3.1_RB2.04.01.01.55.008_msm7627a_JB_REL_2.0.3.1_Merge_release_AU (Merge)
I/Adreno200-EGL( 3134): Build Date: 04/17/13 Wed
I/Adreno200-EGL( 3134): Local Branch:
I/Adreno200-EGL( 3134): Remote Branch: m/jb_rel_2.0.3.1
I/Adreno200-EGL( 3134): Local Patches: NONE
I/Adreno200-EGL( 3134): Reconstruct Branch: AU_LINUX_ANDROID_JB_REL_2.0.3.1_RB2.04.01.01.55.008 + NOTHING
W/dalvikvm( 3134): VFY: unable to resolve virtual method 1025: Landroid/widget/FrameLayout;.setImportantForAutofill (I)V
W/dalvikvm( 3134): VFY: unable to resolve virtual method 1011: Landroid/widget/FrameLayout;.onApplyWindowInsets (Landroid/view/WindowInsets;)Landroid/view/WindowInsets;
W/dalvikvm( 3134): VFY: unable to resolve virtual method 1019: Landroid/widget/FrameLayout;.onProvideAutofillVirtualStructure (Landroid/view/ViewStructure;I)V
W/dalvikvm( 3134): VFY: unable to resolve virtual method 1024: Landroid/widget/FrameLayout;.requestUnbufferedDispatch (Landroid/view/MotionEvent;)V
W/dalvikvm( 3134): VFY: unable to resolve virtual method 1009: Landroid/widget/FrameLayout;.getRootWindowInsets ()Landroid/view/WindowInsets;
W/dalvikvm( 3134): VFY: unable to find class referenced in signature (Landroid/view/autofill/AutofillId;)
W/dalvikvm( 3134): DexOpt: pure-abstract method 'addChildCount' in Landroid/view/ViewStructure;
W/dalvikvm( 3134): VFY: unable to resolve virtual method 755: Landroid/view/ViewStructure;.addChildCount (I)I
W/dalvikvm( 3134): VFY: rejecting opcode 0x6e at 0x003a
W/dalvikvm( 3134): VFY: rejected Lio/flutter/plugin/editing/TextInputPlugin;.onProvideAutofillVirtualStructure (Landroid/view/ViewStructure;I)V
W/dalvikvm( 3134): Verifier rejected class Lio/flutter/plugin/editing/TextInputPlugin;
W/dalvikvm( 3134): threadid=1: thread exiting with uncaught exception (group=0x416f4438)
E/AndroidRuntime( 3134): FATAL EXCEPTION: main
E/AndroidRuntime( 3134): java.lang.VerifyError: io/flutter/plugin/editing/TextInputPlugin
E/AndroidRuntime( 3134): at io.flutter.embedding.android.FlutterView.attachToFlutterEngine(SourceFile)
E/AndroidRuntime( 3134): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(SourceFile)
E/AndroidRuntime( 3134): at io.flutter.embedding.android.FlutterActivity.createFlutterView(SourceFile)
E/AndroidRuntime( 3134): at io.flutter.embedding.android.FlutterActivity.onCreate(SourceFile)
E/AndroidRuntime( 3134): at android.app.Activity.performCreate(Activity.java:5254)
E/AndroidRuntime( 3134): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
E/AndroidRuntime( 3134): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2038)
E/AndroidRuntime( 3134): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2099)
E/AndroidRuntime( 3134): at android.app.ActivityThread.access$600(ActivityThread.java:138)
E/AndroidRuntime( 3134): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
E/AndroidRuntime( 3134): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3134): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3134): at android.app.ActivityThread.main(ActivityThread.java:4929)
E/AndroidRuntime( 3134): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3134): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 3134): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
E/AndroidRuntime( 3134): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
E/AndroidRuntime( 3134): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 464): Force finishing activity com.xxx/io.flutter.embedding.android.FlutterActivity
W/CursorWindow( 1429): Window is full: requested allocation 131072 bytes, free space 127563 bytes, window size 2097152 bytes
W/CursorWindow( 1429): Window is full: requested allocation 131072 bytes, free space 127563 bytes, window size 2097152 bytes
W/ActivityManager( 464): Activity pause timeout for ActivityRecord{421d1ad8 com.xxx/io.flutter.embedding.android.FlutterActivity}
@huycozy When you reproduced the error on a Pixel, was that an AVD or a physical device? I've done some digging and have a suspicion that this is an emulator issue. I've been able to find similar emulator issues related to the Could not find class 'android.view.autofill.AutofillManager'... error.
I've also been able to reproduce the TextInputPlugin error even when the app does not crash, so I don't think that is the cause.
The issue i originally reported was happening on a real device.
@huycozy When you reproduced the error on a Pixel, was that an AVD or a physical device? I've done some digging and have a suspicion that this is an emulator issue. I've been able to find similar emulator issues related to the Could not find class 'android.view.autofill.AutofillManager'... error.
I was testing on Pixel API 19 emulator. But I can not see the same error message anymore on the latest stable and master channels. I also see the similar warning/info message from adb logcat output:
Could not find method android.view.autofill.AutofillManager.
Actual result:
The app can start normally but it is disconnected after that (from the console log). There is Flutter crash log as below.
Logs
The Flutter output of flutter run --enable-software-rendering -v:
output.txt
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0 22A380 darwin-x64, locale en-VN)
• Flutter version 3.3.9 on channel stable at /Users/huynq/Documents/GitHub/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b8f7f1f986 (31 hours ago), 2022-11-23 06:43:51 +0900
• Engine revision 8f2221fbef
• Dart version 2.18.5
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14A400
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 70.0.5
• Dart plugin version 222.4167.21
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0 22A380 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
[!] Flutter (Channel master, 3.7.0-7.0.pre.18, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
• Flutter version 3.7.0-7.0.pre.18 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f07db4018a (12 minutes ago), 2022-12-14 03:25:49 +0200
• Engine revision 14194c40ec
• Dart version 3.0.0 (build 3.0.0-19.0.dev)
• DevTools version 2.20.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-33, build-tools 31.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.1.1)
• IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (3 available)
• SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.98
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
@camsim99 are you still working on this issue?
I submitted a fix for a bug I found while investigating this (https://github.com/flutter/flutter/pull/116536), but it did not fix the issue.
I've recently done some more testing, and I found that I was able to recreate this on emulators running API 19 and 18 consistently with no changes to the default Flutter app after running it once or twice. I'm still not sure what's going on, but it may have to do with either this error that shows up on every failure
E/AndroidRuntime( 3874): FATAL EXCEPTION: main
E/AndroidRuntime( 3874): Process: com.example.test_19, PID: 3874
E/AndroidRuntime( 3874): java.lang.VerifyError: io/flutter/plugin/editing/TextInputPlugin
E/AndroidRuntime( 3874): at io.flutter.embedding.android.FlutterView.attachToFlutterEngine(FlutterView.java:1159)
E/AndroidRuntime( 3874): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(FlutterActivityAndFragmentDelegate.java:390)
E/AndroidRuntime( 3874): at io.flutter.embedding.android.FlutterActivity.createFlutterView(FlutterActivity.java:800)
E/AndroidRuntime( 3874): at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:650)
E/AndroidRuntime( 3874): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 3874): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 3874): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
E/AndroidRuntime( 3874): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime( 3874): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 3874): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 3874): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3874): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 3874): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 3874): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3874): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3874): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 3874): at com.android.internal.os.ZygoteInit.main(ZygoteI
and/or this error that shows up on runs that succeed
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
I'm wondering if this device-specific or < API 19 specific as they both point to some sort of security or compiling error. Any thoughts would be appreciated! @christopherfujino
I believe that the first issue is what this issue is tracking. It might be worth filing an issue for the second.
As for more detailed thoughts, I'm sorry I don't have any.
OS (ubuntu-latest)
flutter --version
Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b06b8b2710 (4 days ago) • 2023-01-23 16:55:55 -0800
Engine • revision b24591ed32
Tools • Dart 2.19.0 • DevTools 2.20.1
Running "flutter pub get" in flutter_tools...
Resolving dependencies in ../../../../../opt/hostedtoolcache/flutter/stable-3.7.0-x64/packages/flutter_tools...
_fe_analyzer_shared 50.0.0 (52.0.0 available)
analyzer 5.2.0 (5.4.0 available)
archive 3.3.2 (3.3.5 available)
args 2.3.1 (2.3.2 available)
built_value 8.4.2 (8.4.3 available)
checked_yaml 2.0.1 (2.0.2 available)
collection 1.17.0 (1.17.1 available)
completion 1.0.0 (1.0.1 available)
coverage 1.6.1 (1.6.2 available)
dds 2.5.0 (2.7.3 available)
dds_service_extensions 1.3.1 (1.3.2 available)
devtools_shared 2.18.0 (2.20.1 available)
dwds 16.0.2 (16.0.3 available)
frontend_server_client 3.1.0 (3.2.0 available)
intl 0.17.0 (0.18.0 available)
io 1.0.3 (1.0.4 available)
js 0.6.5 (0.6.7 available)
json_annotation 4.7.0 (4.8.0 available)
logging 1.1.0 (1.1.1 available)
matcher 0.12.13 (0.12.[14](https://github.com/Liberxue/tc/actions/runs/4027437475/jobs/6923166600#step:4:15) available)
mime 1.0.2 (1.0.4 available)
native_stack_traces 0.5.2 (0.5.5 available)
path 1.8.2 (1.8.3 available)
sse 4.1.1 (4.1.2 available)
test 1.22.0 (1.22.2 available)
test_api 0.4.[16](https://github.com/Liberxue/tc/actions/runs/4027437475/jobs/6923166600#step:4:17) (0.4.18 available)
test_core 0.4.20 (0.4.22 available)
vm_service 9.4.0 (10.1.1 available)
web_socket_channel 2.2.0 (2.3.0 available)
webdriver 3.0.1 (3.0.2 available)
Got dependencies in ../../../../../opt/hostedtoolcache/flutter/stable-3.7.0-x64/packages/flutter_tools!
Running "flutter pub get" in tc...
Resolving dependencies...
* async 2.10.0 (was 2.9.0)
* aws_dynamodb_api 2.0.0 (was 2.0.0)
* aws_sdk 0.0.3 (was 0.0.3)
* boolean_selector 2.1.1 (was 2.1.0)
* characters 1.2.1 (was 1.2.1)
* clock 1.1.1 (was 1.1.1)
* collection 1.[17](https://github.com/Liberxue/tc/actions/runs/4027437475/jobs/6923166600#step:4:18).0 (was 1.16.0) (1.17.1 available)
* crypto 3.0.2 (was 3.0.2)
* cupertino_icons 1.0.5 (was 1.0.5)
* fake_async 1.3.1 (was 1.3.1)
* flutter_lints 2.0.1 (was 2.0.1)
* flutter_riverpod 1.0.0 (was 1.0.0) (2.1.3 available)
* http 0.13.5 (was 0.13.5)
* http_parser 4.0.2 (was 4.0.2)
* intl 0.[18](https://github.com/Liberxue/tc/actions/runs/4027437475/jobs/6923166600#step:4:19).0 (was 0.17.0)
+ js 0.6.5 (0.6.7 available)
* json_table 2.0.1 (was 2.0.1)
* lints 2.0.1 (was 2.0.1)
* matcher 0.12.13 (was 0.12.12) (0.12.14 available)
* material_color_utilities 0.2.0 (was 0.1.5)
* meta 1.8.0 (was 1.8.0)
* path 1.8.2 (was 1.8.2) (1.8.3 available)
* petitparser 5.1.0 (was 5.1.0)
* riverpod 1.0.0 (was 1.0.0) (2.1.3 available)
* screen_retriever 0.1.5 (was 0.1.4)
* shared_aws_api 2.0.1 (was 2.0.0)
* sidebarx 0.14.0 (was 0.14.0)
* source_span 1.9.1 (was 1.9.0)
* split_view 3.2.1 (was 3.2.1)
* stack_trace 1.11.0 (was 1.10.0)
* state_notifier 0.7.2+1 (was 0.7.2+1)
* stream_channel 2.1.1 (was 2.1.0)
* string_scanner 1.2.0 (was 1.1.1)
* term_glyph 1.2.1 (was 1.2.1)
* test_api 0.4.16 (was 0.4.12) (0.4.18 available)
* typed_data 1.3.1 (was 1.3.1)
* uuid 3.0.7 (was 3.0.7)
* vector_math 2.1.4 (was 2.1.2)
* window_manager 0.2.9 (was 0.2.8) (0.3.0 available)
* xml 6.2.2 (was 6.1.0)
Changed [40](https://github.com/Liberxue/tc/actions/runs/4027437475/jobs/6923166600#step:4:41) dependencies!
[!] The "format" command is deprecated and will be removed in a future version of Flutter. Please use the "dart format" sub-command instead, which takes all of the same command-line arguments as "flutter format".
Formatted 8 files (0 changed) in 0.[51](https://github.com/xxx/xxx/actions/runs/4027437475/jobs/6923166600#step:4:52) seconds.
Analyzing tc...
info • 'headline4' is deprecated and shouldn't be used. Use headlineMedium instead. This feature was deprecated after v3.1.0-0.0.pre • lib/view_page.dart:13:[68](https://github.com/xxxx/xxx/actions/runs/4027437475/jobs/6923166600#step:4:69) • deprecated_member_use
1 issue found. (ran in 13.0s)
view_page.dart
import 'package:flutter/material.dart';
import 'package:liber/page_scaffold.dart';
class ViewPage extends StatelessWidget {
const ViewPage({super.key});
@override
Widget build(BuildContext context) {
return PageScaffold(
title: 'View Page',
body: Center(
child:
Text('This's View Page ', style: Theme.of(context).textTheme.headline4),
),
);
}
}
I am also having this exact VerifyError crash issue in Xeonjia (as a user, not a dev), which uses Flutter: https://gitlab.com/deepdaikon/Xeonjia/-/issues/17
However, I can also reproduce it without Flutter on a clean Android Studio project as long as I use:
- Android Jelly Bean or KitKat
- Android Gradle Plugin 7.3
-
minifyEnabled true(so far pretty much what @deckerst observed) - The following code somewhere, e.g. in
MainActivity.onCreate:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ViewStructure test = null;
if (test != null)
test.addChildCount(1);
}
For some reason, DalvikVM's bytecode verifier rejects the method invocation instead of replacing it with a throw like in many other cases.
Upgrading to AGP 7.4 or downgrading to 7.2 fixes the problem for me (although I haven't tried a Flutter project). So I doubt this is a Flutter issue.
I'm not convinced this is a Flutter issue, either. After doing a little more research, it seems like code/resource shrinking this on debug mode is generally discouraged (see docs, it is mentioned a couple places there). However, it is done by default for release builds on Flutter, so that should be working fine.
Maybe i wasn't clear in my original issue description. It was crashing in release mode. And i found out that it was because of the code shrinking (which is by default in release mode, as you mentioned). Because minification is a crucial ingredient for the crash, i singled it out in my report.
@deckerst Ah, I see. So the code snippet you included in the issue above is incorrect? I'm wondering how I can properly reproduce the issue.
The code snippet (explicitly enabling minification) is only necessary for debug mode, yes.
Because testing release mode is difficult without a physical device, i provided the snippet so that people can test with an emulator in debug mode. Sorry if this snippet confused you.
The point is, minified code (automatic in release mode, or manual in debug mode) with AGP 7.2 was ok, minified code with AGP 7.3 crashes.
To reiterate work that was done before, this error comes without minifyEnabled set to true. I agree with what was said above about the DalvikVM being involved. Thus, I still suspect this may be an Android issue, but I will consider following up internally to see if our Gradle configuration is a factor.
There are a variety of similar issues filed that have led me to this conclusion, for example:
- https://b.corp.google.com/issues/252558440
- https://b.corp.google.com/issues/247932119
@camsim99 is this something we need to track on the Flutter issue tracker? And if so, is it still a p3?
Since it seems like an Android issue and I'm not actively working on it, I'll bump it down to a P4 for now. Shouldn't need to be escalated right now.
Since it seems like an Android issue and I'm not actively working on it, I'll bump it down to a P4 for now. Shouldn't need to be escalated right now.
Sounds good to me.
Just to confirm what was pointed above, upgrading to AGP 7.4 fixes this for me.
This issue is assigned to @camsim99 but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!