CaiJingLong / flutter_ijkplayer

ijkplayer for flutter
MIT License
789 stars 149 forks source link

[Bug] 使用一个简单的示例,播放的时候崩溃 #201

Open liudonghua123 opened 4 years ago

liudonghua123 commented 4 years ago

描述一下你遇到的 bug 我写了一个简单的示例,在x86模拟器中运行的时候直接崩溃,从错误提示上看缺少 libijkffmpeg.so

重现 bug

通过什么样的步骤可以重现:

  1. write a simple page like this
Simple code ```dart import 'package:flutter/material.dart'; import 'package:flutter_ijkplayer/flutter_ijkplayer.dart'; class ClueDetailPage extends StatefulWidget { ClueDetailPage({Key key, @required Map this.clue}) : super(key: key); static String tag = 'clue-detail-page'; final Map clue; @override _ClueDetailPageState createState() => _ClueDetailPageState(); } class _ClueDetailPageState extends State { IjkMediaController controller = IjkMediaController(); @override void dispose() { controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { Map clue = widget.clue; return Scaffold( appBar: AppBar( title: Text(clue['xsbt']), actions: [ IconButton( icon: Icon(Icons.videocam), onPressed: null, ), ], ), body: Padding( padding: EdgeInsets.all(16.0), child: Container( height: 400, child: IjkPlayer( mediaController: controller, ), ), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.play_arrow), onPressed: () async { await controller.setNetworkDataSource( 'https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4', autoPlay: true); print("set data source success"); // controller.playOrPause(); })); } } ```

日志

debug console

E/flutter (14751): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86, /data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/base.apk!/lib/x86, /system/lib]]] couldn't find "libijkffmpeg.so"

adb shell

generic_x86:/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86 $ pwd
/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86
generic_x86:/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86 $
generic_x86:/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86 $ ls -l
total 27048
-rwxr-xr-x 1 system system 27689296 1979-11-30 00:00 libflutter.so
generic_x86:/data/app/com.example.jeecgboot_app-64tKfJ7vVZYe9-7F30ws0A==/lib/x86 $

flutter 版本

D:\code\flutter\jeecgboot_app> flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale en-US)
    • Flutter version 1.12.13+hotfix.8 at D:\apps\flutter
    • Framework revision 0b8abb4724 (2 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at D:\apps\android_sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = D:\apps\android_sdk
    • Java binary at: D:\apps\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[!] Android Studio (version 3.5)
    • Android Studio at D:\apps\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code, 64-bit edition (version 1.42.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.8.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

! Doctor found issues in 1 category.

D:\code\flutter\jeecgboot_app>
CaiJingLong commented 4 years ago

建议将 debug 的apk文件在android studio中打开, 以确定是否有该so.