1

Flutter application is stuck on splash page on release mode(only) Sharing the error stack trace

E/flutter (24026): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)

E/flutter (24026): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156)
E/flutter (24026): #1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:138)
E/flutter (24026): #2      HiveX.initFlutter (package:hive_flutter/src/hive_extensions.dart:12)
E/flutter (24026): #3      Future.wait.<anonymous closure> (dart:async/future.dart)
E/flutter (24026): #4      initializePlugins (package:application/main.dart:93)
E/flutter (24026): #5      main (package:application/main.dart:116)

I am able to resolve the issue by disabling minify in android build gradle

Thanks for sharing the answer

android {
    ...

    buildTypes {
        release {
            ...

            shrinkResources false
            minifyEnabled false
        }
    }
}

Is there a way to solve this issue without disabling minifyEnabled ?

1 Answers1

1

Ok this is a little bug. If you add new library or plugin and run hot restart this will occur. Try to clean the project using flutter clean command then kill the running application from our device then run it again. Hope this will solved.

pavel
  • 1,603
  • 22
  • 19
  • Hi @pavel Issue is happening when I try to create release builds. App works fine when you run on debug mode. Another thing this is not a new plugin i added this plugin long back but I have started noticing this issue after the migration to flutter 2.0 – SOUGANDH M.P Jun 30 '21 at 12:26
  • is this latest version of this plugin? – pavel Jun 30 '21 at 12:29
  • yes , path_provider 2.0.2, I see a lot of people reported this issue but the only working solution I got is to set minifyEnabled as false – SOUGANDH M.P Jun 30 '21 at 12:33
  • I don't thik this is a good solution. Can you try some old version? – pavel Jun 30 '21 at 16:32
  • I do have the same opinion as this is not a good solution. I have tried different gradle versions. Also for path provider I need to use any versions above 2.0.0 as I am working with null safety. – SOUGANDH M.P Jun 30 '21 at 21:52