Skip to content

Error Building Flet App Due to flet-audio-recorder==0.1.0 in pyproject.toml #5003

@JayasuryaDaikoku

Description

@JayasuryaDaikoku

Duplicate Check

Describe the bug

When including flet-audio-recorder==0.1.0 in the pyproject.toml dependencies and attempting to build a Flet app, the build process fails with an error message:
"Error building Flet app - see the log of failed command above."

Code sample

Code

import flet as ft

import flet_audio_recorder as far

async def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.appbar = ft.AppBar(title=ft.Text("Audio Recorder"), center_title=True)

path = "test-audio-file.wav"

async def handle_start_recording(e):
    print(f"StartRecording: {path}")
    await audio_rec.start_recording_async(path)

async def handle_stop_recording(e):
    output_path = await audio_rec.stop_recording_async()
    print(f"StopRecording: {output_path}")
    if page.web and output_path is not None:
        await page.launch_url_async(output_path)

async def handle_list_devices(e):
    devices = await audio_rec.get_input_devices_async()
    print(devices)

async def handle_has_permission(e):
    try:
        print(f"HasPermission: {await audio_rec.has_permission_async()}")
    except Exception as e:
        print(e)

async def handle_pause(e):
    print(f"isRecording: {await audio_rec.is_recording_async()}")
    if await audio_rec.is_recording_async():
        await audio_rec.pause_recording_async()

async def handle_resume(e):
    print(f"isPaused: {await audio_rec.is_paused_async()}")
    if await audio_rec.is_paused_async():
        await audio_rec.resume_recording_async()

async def handle_audio_encoding_test(e):
    for i in list(far.AudioEncoder):
        print(f"{i}: {await audio_rec.is_supported_encoder_async(i)}")

async def handle_state_change(e):
    print(f"State Changed: {e.data}")

audio_rec = far.AudioRecorder(
    audio_encoder=far.AudioEncoder.WAV,
    on_state_changed=handle_state_change,
)
page.overlay.append(audio_rec)
await page.update_async()

await page.add_async(
    ft.ElevatedButton("Start Audio Recorder", on_click=handle_start_recording),
    ft.ElevatedButton("Stop Audio Recorder", on_click=handle_stop_recording),
    ft.ElevatedButton("List Devices", on_click=handle_list_devices),
    ft.ElevatedButton("Pause Recording", on_click=handle_pause),
    ft.ElevatedButton("Resume Recording", on_click=handle_resume),
    ft.ElevatedButton("Test AudioEncodings", on_click=handle_audio_encoding_test),
    ft.ElevatedButton("Has Permission", on_click=handle_has_permission),
)

ft.app(main)

To reproduce

(env) C:\Users\hello\OneDrive\Desktop\fletnewversionmain>flet --version
0.27.4

Expected behavior

[project]
name = "fletnewversionmain"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.9"
authors = [
{ name = "Flet developer", email = "you@example.com" }
]
dependencies = [
"flet-audio-recorder==0.1.0",
"flet==0.27.4"
]

[tool.flet]

org name in reverse domain name notation, e.g. "com.mycompany".

Combined with project.name to build bundle ID for iOS and Android apps

org = "com.mycompany"

project display name that is used as an app title on Android and iOS home screens,

shown in window titles and about app dialogs on desktop.

product = "fletnewversionmain"

company name to display in about app dialogs

company = "Flet"

copyright text to display in about app dialogs

copyright = "Copyright (C) 2025 by Flet"

[tool.flet.app]
path = "src"

[tool.uv]
dev-dependencies = [
"flet[all]==0.27.4",
]

[tool.poetry]
package-mode = false

[tool.poetry.group.dev.dependencies]
flet = {extras = ["all"], version = "0.27.4"}

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

windows 11

Flet version

flet==0.27.4

Regression

No, it isn't

Suggestions

No response

Logs

Logs

(env) C:\Users\hello\OneDrive\Desktop\fletnewversionmain>flet build apk -v
[11:59:14] Run subprocess: ['C:\src\flutter\bin\flutter.BAT', '--version', '--no-version-check', '--suppress-analytics']
[11:59:15] Flutter 3.27.4 installed ✅
Flutter executable: C:\Users\hello\flutter\3.27.4\bin\flutter.bat
Dart executable: C:\Users\hello\flutter\3.27.4\bin\dart.bat
JAVA_HOME points to a JRE. Proceeding to install JDK.
JDK installed at C:\Users\hello\java\17.0.13+11
Configuring Flutter's path to JDK
Run subprocess: ['C:\Users\hello\flutter\3.27.4\bin\flutter.bat', 'config', '--no-version-check', '--suppress-analytics',
'--jdk-dir=C:\Users\hello\java\17.0.13+11']
[11:59:16] Setting "jdk-dir" value to "C:\Users\hello\java\17.0.13+11".

       You may need to restart any open editors for them to read new settings.
       JDK installed ✅                                                                                                                                                       
       Android SDK installation found at C:\Users\hello\AppData\Local\Android\Sdk
       Android SDK package "cmdline-tools;latest" is already installed
       Android SDK package "platform-tools" is already installed
       Android SDK package "platforms;android-35" is already installed
       Android SDK package "build-tools;34.0.0" is already installed
       Android SDK installed ✅                                                                                                                                               

[11:59:23] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref "0.27.4" ✅
Run subprocess: ['C:\Users\hello\flutter\3.27.4\bin\dart.bat', 'run', '--suppress-analytics', 'serious_python:main', 'package',
'C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src', '--platform', 'Android', '--requirements', 'flet-audio-recorder==0.1.0,flet==0.27.4', '--exclude',
'build', '--cleanup-packages']
[11:59:44] Running package command
Extra PyPi indexes: [https://pypi.flet.dev]
Creating asset directory: C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\app
Created temp directory: C:\Users\hello\AppData\Local\Temp\serious_python_temp401041ed
Copying Python app from C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src to a temp directory
Configured Android/arm64-v8a platform with sitecustomize.py
Installing [flet-audio-recorder==0.1.0, flet==0.27.4] with pip command to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\site-packages\arm64-v8a
Downloading Python distributive from
https://github.com/astral-sh/python-build-standalone/releases/download/20250205/cpython-3.12.9+20250205-x86_64-pc-windows-msvc-shared-install_only_stripped.tar.gz to a
build directory
[11:59:51] Extracting Python distributive
[12:00:33] Copying Flutter packages to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter-packages-temp
Cleanup installed packages
Configured Android/armeabi-v7a platform with sitecustomize.py
Installing [flet-audio-recorder==0.1.0, flet==0.27.4] with pip command to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\site-packages\armeabi-v7a
[12:00:51] Cleanup installed packages
Configured Android/x86_64 platform with sitecustomize.py
Installing [flet-audio-recorder==0.1.0, flet==0.27.4] with pip command to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\site-packages\x86_64
[12:01:10] Cleanup installed packages
[12:01:11] Configured Android/x86 platform with sitecustomize.py
Installing [flet-audio-recorder==0.1.0, flet==0.27.4] with pip command to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\site-packages\x86
[12:01:28] Cleanup installed packages
[12:01:29] Creating app archive at C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\app/app.zip from a temp directory
Writing app archive hash to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\app/app.zip.hash
Deleting temp directory
Packaged Python app ✅
Found Flutter extension at C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter-packages\flet_audio_recorder
Registered Flutter user extensions ✅
[12:01:34] Found "icon" image at C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src\assets\icon.png
Copying image C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src\assets\icon.png to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\images
Customized app icons ✅
Run subprocess: ['C:\Users\hello\flutter\3.27.4\bin\dart.bat', 'run', '--suppress-analytics', 'flutter_launcher_icons']
[12:01:47] ════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.14.3)
════════════════════════════════════════════

       • Creating default icons Android
       • Overwriting the default Android launcher icon with a new icon
       • Creating adaptive icons Android

[12:01:48] • No colors.xml file found in your Android project
• Creating colors.xml file and adding it to your Android project
• Creating mipmap xml file Android
• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...
[12:01:49] Creating Icons for Windows...
Creating Icons for MacOS...

       ✓ Successfully generated launcher icons

[12:01:50] Generated app icons ✅
Found "icon" image at C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src\assets\icon.png
Copying image C:\Users\hello\OneDrive\Desktop\fletnewversionmain\src\assets\icon.png to C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\images
Customized app splash images ✅
Run subprocess: ['C:\Users\hello\flutter\3.27.4\bin\dart.bat', 'run', '--suppress-analytics', 'flutter_native_splash:create']
[12:01:54] [Android] Creating default splash images
[Android] Creating dark mode splash images
[Android] Creating default android12splash images
[12:01:55] [Android] Creating dark mode android12splash images
[Android] Updating launch background(s) with splash image path...
[Android] - android/app/src/main/res/drawable/launch_background.xml
[Android] - android/app/src/main/res/drawable-night/launch_background.xml
[Android] - android/app/src/main/res/drawable-v21/launch_background.xml
[Android] - android/app/src/main/res/drawable-night-v21/launch_background.xml
[Android] Updating styles...
[Android] - android/app/src/main/res/values-v31/styles.xml
[Android] No android/app/src/main/res/values-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-v31/styles.xml and adding it to your Android project
[Android] - android/app/src/main/res/values-night-v31/styles.xml
[Android] No android/app/src/main/res/values-night-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-night-v31/styles.xml and adding it to your Android project
[Android] - android/app/src/main/res/values/styles.xml
[Android] - android/app/src/main/res/values-night/styles.xml
[iOS] Creating images
[iOS] Creating dark mode images
[12:01:56] [iOS] Updating ios/Runner/Info.plist for status bar hidden/visible
[Web] Creating images
[Web] Creating images
[12:01:57] [Web] Creating background images
[Web] Creating CSS
[Web] Updating index.html

       ✅ Native splash complete.
       Now go finish building something awesome! 💪 You rock! 🤘🤩
       Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash

       Generated splash screens ✅                                                                                                                                            
       Run subprocess: ['C:\\Users\\hello\\flutter\\3.27.4\\bin\\flutter.bat', 'build', 'apk', '--no-version-check', '--suppress-analytics', '--build-name', '0.1.0']         

[12:01:58] Resolving dependencies...
[12:01:59] Downloading packages...
[12:02:00] archive 3.6.1 (4.0.4 available)
characters 1.3.0 (1.4.0 available)
clock 1.1.1 (1.1.2 available)
collection 1.19.0 (1.19.1 available)
device_info_plus 11.3.0 (11.3.2 available)
ffi 2.1.3 (2.1.4 available)
file_picker 8.3.7 (9.0.2 available)
fl_chart 0.69.2 (0.70.2 available)
! flet 0.27.2 (overridden) (0.27.4 available)
flutter_lints 2.0.3 (5.0.0 available)
flutter_native_splash 2.4.4 (2.4.5 available)
image 4.3.0 (4.5.3 available)
intl 0.19.0 (0.20.2 available)
js 0.6.7 (0.7.2 available)
lints 2.1.1 (5.1.1 available)
material_color_utilities 0.11.1 (0.12.0 available)
meta 1.15.0 (1.16.0 available)
path 1.9.0 (1.9.1 available)
petitparser 6.0.2 (6.1.0 available)
! record 5.2.1 (overridden)
sensors_plus 4.0.2 (6.1.1 available)
sensors_plus_platform_interface 1.2.0 (2.0.1 available)
toml 0.15.0 (0.16.0 available)
url_strategy 0.2.0 (discontinued)
! wakelock_plus 1.2.10 (overridden)
! web 1.1.1 (overridden)
web_socket_channel 2.4.5 (3.0.2 available)
! webview_flutter_android 4.3.2 (overridden)
win32 5.10.1 (5.11.0 available)
win32_registry 1.1.5 (2.1.0 available)
! window_manager 0.4.3 (overridden)
Got dependencies!
1 package is discontinued.
26 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.
[12:02:01]
[12:02:37] Running Gradle task 'assembleRelease'...
Gradle build config:
minSdkVersion: 21
targetSdkVersion: 35
versionCode: 1
versionName: 0.1.0
[12:02:55] Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions
of Android Studio and the command-line tools that were released at different times.
[12:03:53] Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 209160 bytes (18.8% reduction). Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1261080 bytes (23.3% reduction). Tree-shaking can be disabled by providing the
--no-tree-shake-icons flag when building your app.
[12:05:08] C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\android\app\src\main\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:record_android]
C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\build\record_android\intermediates\merged_manifest\release\processReleaseManifest\AndroidManifest.xml
as the library might be using APIs not available in 21
Suggestion: use a compatible library with a minSdk of at most 21,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="com.llfbandit.record" to force usage (may lead to runtime failures)
[12:05:20]
FAILURE: Build failed with an exception.

       * What went wrong:
       Execution failed for task ':app:processReleaseMainManifest'.
       > Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:record_android]
       C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\build\record_android\intermediates\merged_manifest\release\processReleaseManifest\AndroidManifest.xml 
       as the library might be using APIs not available in 21
               Suggestion: use a compatible library with a minSdk of at most 21,
                       or increase this project's minSdk version to at least 23,
                       or use tools:overrideLibrary="com.llfbandit.record" to force usage (may lead to runtime failures)

       * Try:
       > Run with --stacktrace option to get the stack trace.
       > Run with --info or --debug option to get more log output.
       > Run with --scan to get full insights.
       > Get more help at https://help.gradle.org.

[12:05:21]
BUILD FAILED in 3m 18s
Running Gradle task 'assembleRelease'... 199.2s

       ┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
       │ The plugin record_android requires a higher Android SDK version.                              │
       │ Fix this issue by adding the following to the file                                            │
       │ C:\Users\hello\OneDrive\Desktop\fletnewversionmain\build\flutter\android\app\build.gradle:    │
       │ android {                                                                                     │
       │   defaultConfig {                                                                             │
       │     minSdkVersion 23                                                                          │
       │   }                                                                                           │
       │ }                                                                                             │
       │                                                                                               │
       │ Following this change, your app will not be available to users running Android SDKs below 23. │
       │ Consider searching for a version of this plugin that supports these lower versions of the     │
       │ Android SDK instead.                                                                          │
       │ For more information, see: https://flutter.dev/to/review-gradle-config                        │
       └───────────────────────────────────────────────────────────────────────────────────────────────┘
       Gradle task assembleRelease failed with exit code 1
       <_io.TextIOWrapper name=4 encoding='utf-8'>                                                                                                                            
       Run subprocess: ['C:\\Users\\hello\\flutter\\3.27.4\\bin\\flutter.bat', 'doctor', '--no-version-check', '--suppress-analytics']                                        

[12:05:27] Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.4, on Microsoft Windows [Version 10.0.26100.3194], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
[√] Android Studio (version 2024.2)
[√] VS Code (version 1.97.2)
[√] Connected device (3 available)
[√] Network resources

       • No issues found!                                                                                                                                                     

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Error building Flet app - see the log of failed command above. │

Additional details

No response

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