Skip to content

[camera_android_camerax] Trying to record video with audio disabled results with SecurityException #175020

@orestesgaolin

Description

@orestesgaolin

What package does this bug report belong to?

camera

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock

pubspec.lock.zip

Steps to reproduce

  1. Open example app of camera_android_camerax
  2. Run it on Android 15 Samsung S23
  3. Select camera and do not grant microphone permission
  4. Disable audio recording
  5. Start recording

Expected results

Recording should start without audio as per this PR flutter/packages#9264 and this issue #168551

Actual results

SecurityException is thrown:

Error: SecurityException
Error Message: java.lang.SecurityException: Attempted to enable audio for recording but application does not have RECORD_AUDIO permission granted.

Code sample

Code sample

https://github.com/flutter/packages/blob/main/packages/camera/camera_android_camerax/example/lib/main.dart

Screenshots or Videos

Screenshots / Video demonstration
example.mp4

Logs

Logs

log.log

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.3, on macOS 15.6.1 24G90 darwin-arm64, locale pl-PL) [461ms]
    • Flutter version 3.35.3 on channel stable at /Users/dominik/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a402d9a437 (3 days ago), 2025-09-03 14:54:31 -0700
    • Engine revision ddf47dd3ff
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, no-enable-linux-desktop, enable-macos-desktop, no-enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [865ms]
    • Android SDK at /Users/dominik/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    ✗ cmdline-tools component is missing.
      Try installing or updating Android Studio.
      Alternatively, download the tools from https://developer.android.com/studio#command-line-tools-only and make sure to set the ANDROID_HOME environment variable.
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1 287ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [8ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)

[✓] VS Code (version 1.103.2) [6ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.118.0

[✓] Connected device (5 available) [6,2s]
    • SM S911B (mobile)       • RFCW60DP85H                          • android-arm64  • Android 15 (API 35)
    • iPhone 12 mini (mobile) • 00008101-0001510C3CF0001E            • ios            • iOS 18.6.2 22G100
    • iPhone 16e (mobile)     • 433F5057-30A3-4238-B306-F427B186E9E0 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
    • macOS (desktop)         • macos                                • darwin-arm64   • macOS 15.6.1 24G90 darwin-arm64
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 139.0.7258.155

[✓] Network resources [614ms]
    • All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.p: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions