Skip to content

Path Provider PlatformException 'Unable to establish connection on channel' #129

@niclasEX

Description

@niclasEX

Trying to use path_provider together with this package (tested ffmpeg_kit_flutter_new and ffmpeg_kit_flutter_new_min) it returns

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationDocumentsPath"., null, null)
E/flutter ( 4072): #0      PathProviderApi.getApplicationDocumentsPath (package:path_provider_android/messages.g.dart:142)
E/flutter ( 4072): <asynchronous suspension>
E/flutter ( 4072): #1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121)
E/flutter ( 4072): <asynchronous suspension>
E/flutter ( 4072): #2      main (package:loadapp_reloaded/main.dart:38)
E/flutter ( 4072): <asynchronous suspension>
E/flutter ( 4072):

This only occurs in release. This can be reproduced on multiple Android devices.

niclas$ flutter --version
Flutter 3.38.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f5a8537f90 (3 weeks ago) • 2025-11-18 09:27:21 -0500
Engine • hash 78c3c9557e50ee7c676fa37562558c59efd8406a (revision b5990e5ccc) (26 days ago) • 2025-11-12 21:08:24.000Z
Tools • Dart 3.10.0 • DevTools 2.51.1

I have created a minimal reproducible example here with 2 applications.

  • ffmpeg_path_provider_mre
    • dependes on path_provider and ffmpeg_kit_flutter_new
    • calls getApplicationsDocumentsDirectory()
    • breaks in release with the aforementioned exception
  • ffmpeg_pigeon_mre
    • depends on ffmpeg_kit_flutter_new
    • implements a minimal example using pigeon for ffi setup
    • does not break in release

This workaround enables path_provider to work as expected

[app/build.gradle]
...
buildTypes {
        release {
            // workaround: uncomment the following lines to make path_provider work as expected
            // isMinifyEnabled = false
            // isShrinkResources = false
            signingConfig = signingConfigs.getByName("debug")
        }
    }

I have tried to create some ProGuard Rules to no success (both for path_provider andffmpeg_kit_flutter_new).

I can not quite say why this is breaking and if path_provider and/or ffmpeg_kit_flutter_new might have to change something to make this work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions