【ffmpeg_kit_flutter_new_audio】黑屏/卡启动页

191 阅读1分钟

前言

ffmpeg_kit_flutter_new_audio |颤振包

1. 特点

  • 更新的绑定:Android 和 macOS

  • 包括:两者兼而FFmpeg``FFprobe

  • 支持的平台

    • Android
    • iOS
    • macOS
  • FFmpeg 版本v7.1.1

  • Kotlin 版本v1.8.22

  • 支持的架构

    • 安卓:

      • arm-v7a
      • arm-v7a-neon
      • arm64-v8a
      • x86
      • x86_64
      • 需要或更高版本Android API Level 24
    • iOS的:

      • armv7
      • armv7s
      • arm64
      • x86_64
      • x86_64-mac-catalyst
      • arm64-mac-catalyst
      • 需要或更高版本iOS SDK 14.0
    • macOS的:

      • arm64
      • x86_64
      • 需要或更高版本macOS SDK 10.15
  • 存储访问:可以在 Android 上处理存储访问框架

常见问题和解决方案

安卓在debug模式下运行正常,切换到release模式,卡在启动页(黑屏)。通过logcat获取到错误 Bad JNI version returned from JNI_OnLoad: 0 表明原生库编译时未正确配置 JNI 版本(正常应返回 JNI_VERSION_1_6 等有效版本)。

解决方案

将这些全面的 Proguard 规则添加到您的 android/app/proguard-rules.pro:

# FFmpegKit rules
-keep class com.antonkarpenko.ffmpegkit.** { *; }
-dontwarn com.antonkarpenko.ffmpegkit.**

# Keep all FFmpegKit native methods
-keepclasseswithmembernames class * {
    native <methods>;
}

# Keep FFmpegKit Config
-keep class com.antonkarpenko.ffmpegkit.FFmpegKitConfig {
    *;
}

# Keep ABI Detection
-keep class com.antonkarpenko.ffmpegkit.AbiDetect {
    *;
}

# Keep all FFmpegKit sessions
-keep class com.antonkarpenko.ffmpegkit.*Session {
    *;
}

# Keep FFmpegKit callbacks
-keep class com.antonkarpenko.ffmpegkit.*Callback {
    *;
}

# Preserve all public classes in ffmpegkit
-keep public class com.antonkarpenko.ffmpegkit.** {
    public *;
}

# Keep reflection-based access
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes InnerClasses