您的位置:首页 > 移动开发 > Android开发

Windows下编译android版ijkplayer

2017-04-21 16:40 183 查看
今天也来编译一下ijkplayer ,并做记录。

先普及一下cygwin和mingw知识

cygwin和mingw都是为用户提供在windows操作系统使用GNU工具的方法,使得在windows上可以编译为linux写的c源代码并运行(让你可以用signal等linux才有的api)。

真正的不同在于

1,cygwin大,mingw小

2,cygwin编译后的exe需要cygwin1.dll作为支持,而mingw不需要就可以直接运行,因为有中间层所以cygwin慢,mingw快。

3,cygwin包含的内容更全面,能编译通过的linux源文件更多,mingw的min是minimalist所以能编译通过的更少。但,不是全部,就是说别指望你可以把任何为linux写的源代码在cygwin或mingw编译通过并运行。

编译之前请确保已经配置好环境。关于配置细节请自行百度,不过一般在此之前都配置过了。

1.安装cygwin,并安装git,make,ysam

2.设置环境变量

在cygwin的home目录下,修改 ~/.bash_profile 或 ~/.profile文件,添加

export ANDROID_SDK=

export ANDROID_NDK=

其中的路径根据实际情况填写。

//clone 源码到本地
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android

cd ijkplayer-android
//切换最新分支
git checkout -B latest k0.8.0

//流程化脚本编译
//1、编译前选择你的配置
//If you prefer more codec/format

cd config
rm module.sh
ln -s module-default.sh module.sh

//If you prefer less codec/format for smaller binary size (include hevc function)
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh

//If you prefer less codec/format for smaller binary size (by default)
cd config
rm module.sh
ln -s module-lite.sh module.sh

//执行脚本 会自动下载ffmpeg
./init-android.sh

//最后开始编译
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all

cd ..
./compile-ijk.sh all


导入Android Studio运行

如果编译带HTTPS的so

./init-android-openssl.sh
./init-android.sh

./compile-openssl.sh clean//清除
./compile-ffmpeg.sh clean//清除
./compile-openssl.sh all//编译
./compile-ffmpeg.sh all//编译

./compile-ijk.sh all


生成的so每种类型有三个,ffmepg的so大于3M就是https成功的标志啦!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: