728x90
Flutter video player 개발중에 아래와 같이 에러가 발생했다
E/MethodChannel#better_player_channel(29539): Failed to handle method call
E/MethodChannel#better_player_channel(29539): java.lang.NullPointerException: MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior.
E/MethodChannel#better_player_channel(29539): at com.google.android.exoplayer2.util.Assertions.checkNotNull(Assertions.java:174)
E/MethodChannel#better_player_channel(29539): at com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory.setDrmSessionManagerProvider(HlsMediaSource.java:296)
E/MethodChannel#better_player_channel(29539): at com.jhomlala.better_player.BetterPlayer.buildMediaSource(BetterPlayer.kt:424)
E/MethodChannel#better_player_channel(29539): at com.jhomlala.better_player.BetterPlayer.setDataSource(BetterPlayer.kt:196)
E/MethodChannel#better_player_channel(29539): at com.jhomlala.better_player.BetterPlayerPlugin.setDataSource(BetterPlayerPlugin.kt:277)
E/MethodChannel#better_player_channel(29539): at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:151)
E/MethodChannel#better_player_channel(29539): at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:138)
E/MethodChannel#better_player_channel(29539): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#better_player_channel(29539): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#better_player_channel(29539): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#better_player_channel(29539): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#better_player_channel(29539): at android.os.Handler.handleCallback(Handler.java:942)
E/MethodChannel#better_player_channel(29539): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#better_player_channel(29539): at android.os.Looper.loopOnce(Looper.java:226)
E/MethodChannel#better_player_channel(29539): at android.os.Looper.loop(Looper.java:313)
E/MethodChannel#better_player_channel(29539): at android.app.ActivityThread.main(ActivityThread.java:8757)
E/MethodChannel#better_player_channel(29539): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#better_player_channel(29539): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/MethodChannel#better_player_channel(29539): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
해결책
android/app/build.gradle 파일에 multiDex를 활성화 해준다.
- multiDexEnabled true 를 defaultConfig에 넣어준다.
defaultConfig {
applicationId "com.qualson.speakingapp"
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
multiDexEnabled true
}
아직도 해결이 되지 않았다면, pubspec.yml 파일에 플레이어 관련된 라이브러리 better_player만 두고 전부 제거한다.
ex) video_player, chewie, lecle_yoyo_player
LIST