简体   繁体   中英

Flutter Android app crashes on startup with no errors

I have an Android app that was built with Flutter. I previously encountered this error

[Dependency failing: com.nimbusds:nimbus-jose-jwt:7.7 -> net.minidev:json-smart@[1.3.1,2.3]][1]

for which I applied this workaround :

 // Bottom of android/app/build.gradle
 com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

It does not seem to be an ideal workaround but at least it bypasses the error.

The project has been migrated to AndroidX according to instructions .

However now on debug, the launch screen opens but the app crashes straight away. The only console errors are:

 registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
 registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
 registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
 Built build/app/outputs/apk/debug/app-debug.apk.

 [✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.4 18E226, locale en-US)

 [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
 [✓] Xcode - develop for iOS and macOS (Xcode 10.3)
 [✓] iOS tools - develop for iOS devices
 [✓] Android Studio (version 3.5)
 [✓] VS Code (version 1.37.1)
 [✓] Connected device (1 available)

pubspec.yaml packages:

 cloud_firestore: ^0.12.9+2
 dio: ^2.1.16
 firebase_auth: ^0.14.0+5
 firebase_core: ^0.4.0+9
 firebase_messaging: ^5.1.4
 firebase_storage: ^3.0.6
 flutter_facebook_login: ^2.0.1
 flutter_local_notifications: ^0.8.2
 flutter_webview_plugin: ^0.3.7
 google_maps_flutter: ^0.5.21
 google_maps_webservice: ^0.0.14
 google_places_picker: ^2.0.2+1
 google_sign_in: ^4.0.7
 geoflutterfire: ^2.0.3+5
 page_transition: ^1.1.4
 stripe_payment: ^0.2.1

How can I fix the startup crash?

Try flutter clean and then flutter run again. It solves this problem most of the times.
Wanted to add this as a comment

You need to provide the error logs thrown from the app when it crashed. If you the issue only occur after migrating to AndroidX, I suggest regenerating the Android build after updating the Flutter SDK that you're using. Run flutter upgrade then delete the /android build folder. Regenerate the android build by running flutter create --platforms=android , then run flutter clean and flutter pub get to rebuild the indexes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM