Build ijkplayer with lib-monitor
Environment Setup
ijkplayer: liblaf/ijkplayer: Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.lib-monitor: liblaf/lib-monitorLLVM@9: llvm@9 — Homebrew FormulaeNDK-r14b: android-ndk-r14b-linux-x86_64.zipNDK-r21e: android-ndk-r21e-linux-x86_64.zipAndroid Studio 2.3.3: android-studio-ide-162.4069837-linux.zip
- prepare the environment as shown above
- follow instructions below to get missing parts of
NDK - configure variables in
ijkplayer/build.shandlib-monitor/inserter/Makefileaccording to your setup - click
AVD Managerand create a device with the following system image:
| Release Name | API Level | ABI | Target |
|---|---|---|---|
| Nougat | 25 | armeabi-v7a | Android 7.1.1 (Google APIs) |
Get Missing Parts of NDK[1]
Info
We are going to use NDK-r21e.
Version information is in file ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/AndroidVersion.txt.
9.0.9
based on r365631c3- visit the corresponding source at clang-r365631c3 - platform/prebuilts/clang/host/linux-x86 - Git at Google and download tgz
- extract the downloaded file and merge it with
${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64.
Tips
You may want to remove clang.real and clang++.real under ${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/.
Build
- launch Android Studio, select
android/ijkplayer/and import - install dependencies according to logs from Android Studio
- run the following scripts:
bash init-android.sh
bash build.shNote
We choose to use NDK-r21e for ffmpeg and NDK-r14b for anything else. There are both c and c++ sources elsewhere. However, the -std=c99 option ( configured in Android.mk ) will cause an error in NDK-r21e ( with newer clang++ ) but simply a warning in NDK-r14b.
Run
- click
Run selected configurationor pressshift + F10in Android Studio - click
Samplein Android Emulator - choose a video from the list and click
Tips
When sliding the video list, the simulator may treat the wheel scroll as a click event, so the safe way is to hold down the mouse and drag.
Info
Sometimes the player would crash. Just try to reopen the video from the list. I’m currently working for a solution.
Debug
ADB
By default, you may find the executable adb at "${HOME}/Android/Sdk/platform-tools/adb". Here are some commonly used adb commands:
./adb devices [-l] # list connected devices (-l for long output)
./adb shell # run remote shell command (interactive shell if no command given)You can enter interactive shell and cd to /sdcard/ to see whether recorder.cov has been created.
logcat
In Android Studio, click 6: Android Monitor and click logcat tab to view logcat. In addition, you can change the level of logging and use the search box ( for example "lib-monitor" ) to filter logs.