上一篇文章说了编译vlc的一些错误,这一篇文章记录我们修改的脚本
我们运行脚本之后会发现一个问题,那就是会出现
Download Gradle
我们知道这是在下载Android的gradle,但是就是这个访问速度着实让人难受所以我们需要去修改compile.sh脚本
sudo vim compile.sh
我们可以看到这一段
if [ ! -d "gradle/wrapper" ]; then
diagnostic "Downloading gradle"
GRADLE_VERSION=5.6.4
GRADLE_URL=https://download.videolan.org/pub/contrib/gradle/gradle-${GRADLE_VERSION}-bin.zip
wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} || fail "gradle: download failed"
unzip -o gradle-${GRADLE_VERSION}-bin.zip || fail "gradle: unzip failed"
./gradle-${GRADLE_VERSION}/bin/gradle wrapper || fail "gradle: wrapper failed"
./gradlew -version || fail "gradle: wrapper failed"
chmod a+x gradlew
rm -rf gradle-${GRADLE_VERSION}-bin.zip
fi
很明显这里是说如果没找到gradle/wrapper这个目录,那就下载gradle
所以我们可以修改这段脚本,删掉下载的代码,把我们下载好的gradle解压,请注意这个脚本用的是5.6.4可以修改成你自己下载好的,我用的就是5.6.4,gradle:https://services.gradle.org/distributions/
if [ ! -d "gradle/wrapper" ]; then
# diagnostic "Downloading gradle"
GRADLE_VERSION=5.6.4
# GRADLE_URL=https://download.videolan.org/pub/contrib/gradle/gradle-${GRADLE_VERSION}-bin.zip
# wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} || fail "gradle: download failed"
unzip -o gradle-${GRADLE_VERSION}-bin.zip || fail "gradle: unzip failed"
./gradle-${GRADLE_VERSION}/bin/gradle wrapper || fail "gradle: wrapper failed"
./gradlew -version || fail "gradle: wrapper failed"
chmod a+x gradlew
rm -rf gradle-${GRADLE_VERSION}-bin.zip
fi
然后我们又会遇到一个问题,那就是又需要下载vlc,同样也是访问速度的问题,我们需要修改这个脚本的这一段
TESTED_HASH=7f204ee
VLC_REPOSITORY=https://git.videolan.org/git/vlc/vlc-3.0.git
if [ ! -d "vlc" ]; then
diagnostic "VLC sources: not found, cloning"
git clone "${VLC_REPOSITORY}" vlc || fail "VLC sources: git clone failed"
cd vlc
diagnostic "VLC sources: resetting to the TESTED_HASH commit (${TESTED_HASH})"
git reset --hard ${TESTED_HASH} || fail "VLC sources: TESTED_HASH ${TESTED_HASH} not found"
diagnostic "VLC sources: applying custom patches"
# Keep Message-Id inside commits description to track them afterwards
git am --message-id ../libvlc/patches/vlc3/*.patch || fail "VLC sources: cannot apply custom patches"
cd ..
else
diagnostic "VLC source: found sources, leaving untouched"
fi
if [ "$BYPASS_VLC_SRC_CHECKS" = 1 ]; then
diagnostic "VLC sources: Bypassing checks (required by option)"
else
diagnostic "VLC sources: Checking TESTED_HASH and patches presence"
diagnostic "NOTE: checks can be bypass by adding '-b' option to this script."
cd vlc
git cat-file -e ${TESTED_HASH} 2> /dev/null || \
fail "Error: Your vlc checkout does not contain the latest tested commit: ${TESTED_HASH}"
for patch_file in ../libvlc/patches/vlc3/*.patch; do
check_patch_is_applied "$patch_file"
done
cd ..
fi
删掉下载的代码,把自己下载好的vlc解压到vlc-Android里,请注意这里的目录名称必须为vlc
然后我们可以继续开始编译vlc
后面我们还会遇到一个问题,那就是gradle的问题,我当时报的错是什么什么byte exist,然后再次执行编译的时候又会说什么compile fail 然后我找了一些资料还是没找到,但是看到一个说是修改为Android studio的jdk,所以我感觉是高版本的gradle或者说是vlc会出现的问题,所以我把jdk的路径改成了Android studio的这时候就通过了,对于下载速度慢的问题我是采取的用服务器的方式,我建议还是用服务器,因为有可能配置方面可能考虑不周全,如果一个一个去处理很麻烦,一定要注意是有外网的服务器
./libvlc/build/outputs/aar/libvlc-armv7-3.3.0-eap03.aar,这里是结果
链接:https://pan.baidu.com/s/1NvFDPvCTm9WPDym3UT1vxA
提取码:rm7c
网友评论