Repository: flutter
Issue: [Add2App] Native app in release mode crashes when using using Option -B
Labels: platform-android,tool,engine,a: existing-apps,a: release,has reproducible steps,P2,c: fatal crash,found in release: 2.2,found in release: 2.3,team-android,triaged-android

Integrate a Flutter module into your Android project,Option A - Depend on the Android Archive (AAR)  ，can run normally in release and debug mode；Option B - Depend on the module’s source code，can run normally in debug mode, but report an error in release mode。The error message is as follows：


```console
2021-06-15 09:33:44.791 26920-26920/com.example.androidflutterdemo E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(18)] VM snapshot invalid and could not be inferred from settings.
2021-06-15 09:33:44.791 26920-26920/com.example.androidflutterdemo E/flutter: [ERROR:flutter/runtime/dart_vm.cc(257)] Could not set up VM data to bootstrap the VM from.
2021-06-15 09:33:44.791 26920-26920/com.example.androidflutterdemo E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(84)] Could not create Dart VM instance.
2021-06-15 09:33:44.791 26920-26920/com.example.androidflutterdemo A/flutter: [FATAL:flutter/shell/common/shell.cc(155)] Check failed: vm. Must be able to initialize the VM.
2021-06-15 09:33:44.797 26920-26920/com.example.androidflutterdemo A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 26920 (roidflutterdemo), pid 26920 (roidflutterdemo)
```

<<details> 
<summary>flutter doctor -v</summary> 
	
```console
 Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.2.1 at /Users/chenbing/cb/workspace/Flutter/flutter
    • Framework revision 02c026b03c (3 weeks ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/chenbing/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/chenbing/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2, Build version 11B52
    ✗ Xcode 11.2.0 out of date (12.0.1 is recommended).
      Download the latest version or update via the Mac App Store.
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods.
      To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • 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.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2019.3.4)
    • IntelliJ at /Applications/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.57.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • JSN AL00a (mobile) • 7XBNW18901036080 • android-arm64  • Android 10 (API 29)
    • Chrome (web)       • chrome           • web-javascript • Google Chrome 91.0.4472.101
```

</details>