Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

flutter - build apk does't work, but debug apk works as expected

My build apk doesn't work as expected. but debug apk works perfectly. when i run flutter run --release -v it shows:-

  • MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)

  • Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)

How can i solve this issue.

question from:https://stackoverflow.com/questions/66058089/build-apk-doest-work-but-debug-apk-works-as-expected

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This probably related with current issue in flutter (https://github.com/flutter/flutter/issues/65334) where DefaultLifecycleObserver got removed by proguard. See explanation: https://github.com/flutter/flutter/issues/58479#issuecomment-763259817

The solution is by adding the line below to your android app/proguard-rules.pro:

-keep class androidx.lifecycle.DefaultLifecycleObserver

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...