Follow these steps to configure Android permissions and build settings:
Permissions
In <project root>/android/app/src/main/AndroidManifest.xml:
Internet Access (for remote media/subtitles):
<uses-permission android:name="android.permission.INTERNET" />
Note: This is often included by default in Flutter projects.
Local Storage (for internal device media/subtitles):
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Network Security
If you encounter "Cleartext HTTP traffic to * is not permitted", add android:usesCleartextTraffic="true" to the <application> tag in AndroidManifest.xml.
To avoid access denied errors on Android 10, add android:requestLegacyExternalStorage="true" to the <application> tag. When using this, access files via paths like /storage/emulated/0/{FilePath} or /sdcard/{FilePath}.
Build Configuration
- In
android/app/build.gradle, add packagingOptions to resolve duplicate C++ library issues:
android {
packagingOptions {
pickFirst 'lib/**/libc++_shared.so'
}
// ...
}
- Create
android/app/proguard-rules.pro and add the following to prevent VLC classes from being stripped during minification:
-keep class org.videolan.libvlc.** { *; }