Skip to content

Hardcoded /storage/emulated/0/Documents path fails on Android 11+ (scoped storage) #117

Description

@chirag127

Problem

saveToDevice writes to a hardcoded /storage/emulated/0/Documents/OpenScan path that is not writable on Android 11+ under scoped storage.

Steps

  1. Install on Android 11+ device (targetSdkVersion 34, per android/app/build.gradle).
  2. Scan a document and tap Save to Device.
  3. Directory.createSync() on /storage/emulated/0/Documents/OpenScan throws.

Expected

PDF saves to a writable app-accessible location (e.g. getExternalStorageDirectory() or SAF-picked directory).

Actual

FileSystemException: Creation failed, path = '/storage/emulated/0/Documents/OpenScan' (OS Error: Permission denied, errno = 13). WRITE_EXTERNAL_STORAGE in AndroidManifest.xml is a no-op on API 30+.

Cite

  • lib/Utilities/file_operations.dart:136
  • lib/Utilities/file_operations.dart:155
  • lib/Utilities/file_operations.dart:157

Environment

Flutter SDK ^3.5.3, compileSdkVersion 34, targetSdkVersion 34, Android 11+.

Thanks for maintaining ethereal-developers/OpenScan!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions