Describe the bug
My Flutter app is not launching on Android when building in release mode after adding file_picker dependency in pubspec.yaml. When I run debug build, everything works OK.
Issue details
- Platform: Android
- Platform OS version: tested and reproduced on 7-11 (mostly on Android 11 on Pixel 3a).
- File type (filter) -
- Detailed steps to reproduce:
- Make a clear release build of the app with
flutter clean
and flutter build apk
.
- Send the file
<PROJECT_DIR>/build/app/outputs/flutter-apk/app-release.apk
to the device and install it.
- Run the app. Everything works as expected, I'm able to interact with my app.
- Add
file_picker: ^2.1.4
,
- Run
flutter pub get
, flutter clean
and then flutter build apk
.
- Send the new file
<PROJECT_DIR>/build/app/outputs/flutter-apk/app-release.apk
to the device and install it.
- Run the app. I can see Android's splash screen, however, after it closes, I'm stuck on a black screen and Flutter app does not load.
- Remove the app from the device. Try running debug build. The app works as expected, Flutter app launched once the Android splash was closed.
Error Log
Nothing to paste here :(
When I try to attach Flutter debugger from Android studio to the opened app on the step 7), the console just keeps showing the message "Waiting for a connection from Flutter on Pixel 3a...".
Screenshots and/or video
If applicable, add screenshots or video to help explain your problem.
Flutter Version details
flutter doctor -v
:
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-GB)
• Flutter version 1.22.5 at /Users/yurii.dvornyk/Documents/flutter
• Framework revision 7891006299 (4 days ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/yurii.dvornyk/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/yurii.dvornyk/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality. (Plugin is actually installed; this is Flutter's known issue)
✗ Dart plugin not installed; this adds Dart specific functionality. (Plugin is actually installed; this is Flutter's known issue)
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.17.0
[!] Connected device
! No devices available
Additional context
Posting the whole pubspec.yaml
content in case it could help.
name: <PROJECT_NAME>
description: <PROJECT_DESCRIPTION>
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
# Firebase
firebase_core: ^0.5.0+1
firebase_crashlytics: ^0.2.1+1
firebase_analytics: ^6.0.2
# UI libraries
flip_card: ^0.4.4
flutter_svg: ^0.19.1
flutter_markdown: ^0.5.1
visibility_detector: ^0.1.5
# Localization
intl: ^0.16.1
flutter_localizations:
sdk: flutter
# Networking
http: ^0.12.2
# Database
moor: ^3.4.0
sqlite3_flutter_libs:
# Paths, Urls, Files
path_provider: ^1.6.24
path: ^1.7.0
url_launcher: ^5.7.10
file_picker: ^2.1.4
mime: ^0.9.7
# Download/Upload
flutter_uploader: ^2.0.0-beta.3
# Photo/video
camera: ^0.5.8+11
video_player: ^1.0.1
video_thumbnail: ^0.2.5
flutter_ffmpeg: ^0.3.0
# Work with devices
device_info: ^1.0.0
wakelock: ^0.2.1+1
dev_dependencies:
flutter_test:
sdk: flutter
# Database
moor_generator: ^3.4.0
build_runner: ^1.10.4
flutter:
uses-material-design: true
assets:
- assets/images/
fonts:
<FONTS_USED_IN_THE_PROJECT>
flutter_intl:
enabled: true
triage android