IJKPlayer Deployment and Usage Guide
1. Prerequisites
Common Requirements
- Mac OS X 10.11.5 or later (required for both Android and iOS builds)
- Homebrew package manager
- Git version control system
- yasm assembler (required for FFmpeg compilation)
Android-Specific Requirements
- Android SDK (set
ANDROID_SDKenvironment variable) - Android NDK r10e (set
ANDROID_NDKenvironment variable) - Android Studio 2.1.3 or later
- Gradle 2.14.1 or later
iOS-Specific Requirements
- Xcode 7.3 (7D175) or later
- iOS 7.0-10.2.x deployment target
Ubuntu/Debian Specific
For Ubuntu/Debian users, configure shell:
sudo dpkg-reconfigure dash
# Choose [No] to use bash
2. Installation
Clone the Repository
# For Android
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.8.8
# For iOS
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios
cd ijkplayer-ios
git checkout -B latest k0.8.8
Install Dependencies
# Install Homebrew, git, and yasm
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew install yasm
3. Configuration
Environment Variables
Add these lines to your ~/.bash_profile or ~/.profile:
export ANDROID_SDK=<your sdk path>
export ANDROID_NDK=<<your ndk path>
Codec/Format Configuration
Choose your preferred codec/format configuration by modifying the module.sh symlink in the config directory:
Default (smaller binary size):
cd config
rm module.sh
ln -s module-lite.sh module.sh
More codecs/formats:
cd config
rm module.sh
ln -s module-default.sh module.sh
HEVC support (smaller binary size):
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh
4. Build & Run
Building for Android
# Initialize Android build environment
./init-android.sh
# Compile FFmpeg
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
# Compile IJKPlayer
cd ..
./compile-ijk.sh all
Android Studio Integration
- Open Android Studio
- Select "Open an existing Android Studio project"
- Navigate to
android/ijkplayer/and import - Define ext block in your root
build.gradle:
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.0"
targetSdkVersion = 23
}
Gradle Build
cd ijkplayer
gradle
Building for iOS
# Initialize iOS build environment
./init-ios.sh
# Compile FFmpeg
cd ios
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
Xcode Integration
- Open
ios/IJKMediaDemo/IJKMediaDemo.xcodeprojwith Xcode to run the demo - To integrate into your own application:
- Select your project in Xcode
- File → Add Files to... → Select
ios/IJKMediaPlayer/IJKMediaPlayer.xcodeproj - Select your Application's target
- Build Phases → Target Dependencies → Select IJKMediaFramework
- Build Phases → Link Binary with Libraries → Add: IJKMediaFramework
5. Deployment
Android Deployment
- Distribution: Google Play Store or alternative Android app stores
- Package: AAR files are generated in the build output
- Dependencies: Include appropriate ABI-specific libraries (armv7a, arm64, x86, etc.)
iOS Deployment
- Distribution: Apple App Store
- Package: Framework bundle (IJKMediaFramework)
- Requirements: iOS 7.0+ deployment target
Gradle Dependency (Android)
Add to your build.gradle:
dependencies {
// required, enough for most devices.
compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
// Other ABIs: optional
compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
}
6. Troubleshooting
Common Issues and Solutions
FFmpeg Compilation Fails
Issue: FFmpeg compilation fails with missing dependencies
Solution: Ensure Homebrew packages are installed: brew install git yasm
Android Build Configuration Issues
Issue: Gradle sync fails due to missing SDK versions
Solution: Update ext block in root build.gradle to match your installed SDK versions
iOS Build Issues
Issue: Framework not found errors in Xcode Solution: Verify that IJKMediaPlayer.xcodeproj is properly added to your workspace and that IJKMediaFramework is linked in Build Phases
ABI Compatibility Issues
Issue: App crashes on certain devices Solution: Ensure you've included the correct ABI libraries for your target devices. ARMv5 is not tested on real devices.
Debugging Native Code on Android Studio 2.2+
Issue: Unable to debug native modules Solution: Apply debugging patches:
sh android/patch-debugging-with-lldb.sh armv7a
Then configure symbol directories in Run → Edit Configurations → Debugger → Symbol Directories.
Ubuntu/Debian Shell Issues
Issue: Build scripts fail on Ubuntu/Debian
Solution: Run sudo dpkg-reconfigure dash and select [No] to use bash instead of dash.
Binary Size Too Large
Issue: Final APK/IPA is too large Solution: Use the lite configuration:
cd config
rm module.sh
ln -s module-lite.sh module.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
HEVC Support Needed
Issue: Need HEVC (H.265) codec support Solution: Use HEVC configuration:
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all