Without Opus/Ogg
Configure builds without Opus and Ogg libraries to reduce binary size
Overview
The Opus and Ogg libraries are embedded by default in flutter_soloud. However, if you don't need streaming capabilities, you can exclude these libraries to reduce your app's binary size by 600~1500 KB (depending on platform).
VS Code Configuration
Add to .vscode/launch.json
:
{
"name": "Flutter debug", // and/or other build configurations
"type": "dart",
"request": "launch",
"program": "lib/main.dart",
"env": {
"NO_OPUS_OGG_LIBS": "1"
}
}
Android Studio Setup
Add under Run/Debug Configurations:
Environment Variables: NO_OPUS_OGG_LIBS="1"
Screenshot


Gradle Build
It is also possible to configure the environment variables in the android/gradle.properties
:
NO_OPUS_OGG_LIBS=true # add this line
or int the android/build.gradle.kts
add this snippet:
allprojects { extra["NO_OPUS_OGG_LIBS"] = "true" }
Command Line Build
# Build without Opus/Ogg
flutter clean
flutter pub get
export NO_OPUS_OGG_LIBS="1" && flutter run
# Reset to default (with Opus/Ogg)
flutter clean
flutter pub get
export NO_OPUS_OGG_LIBS= && flutter run # Unsets the environment variable
iOS/MacOS Setup
Add to ios/Podfile
or macos/Podfile
:
ENV['NO_OPUS_OGG_LIBS'] = '1'
IDE environment variables are ignored for iOS and MacOS builds.