在Mac中编译vlc-android小结

VLC  CodeSource
https://code.videolan.org/explore


This page is an introduction to the compilation of VLC for Android on Linux.  
https://wiki.videolan.org/AndroidCompile/


Android使用VLC库开发自己的视频播放器  https://blog.csdn.net/u011365633/article/details/74278063


Mac编译vlc-android  https://blog.csdn.net/hwliu51/article/details/77417924

 --------------------------------
安装一些工具软件


sudo apt-get install automake ant autopoint cmake build-essential libtool \
     patch pkg-config protobuf-compiler ragel subversion unzip git \
    openjdk-8-jre openjdk-8-jdk flex

或者:
brew install automake ant autopoint cmake build-essential libtool \
patch pkg-config  ragel subversion unzip \
openjdk-8-jre openjdk-8-jdk flex


brew 全称Homebrew,安装
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"    

brew install git

brew install gettext   -->  autopoint
echo 'export PATH="/usr/local/Cellar/gettext/0.19.8.1/bin:$PATH"' >> ~/.bash_profile
退出terminal(终端),重新启动终端,然后输入:echo $PATH,按回车执行命令查看当前变量值


brew install unzip
echo 'export PATH="/usr/local/opt/unzip/bin:$PATH"' >> ~/.bash_profile
退出terminal(终端),重新启动终端,然后输入:echo $PATH,按回车执行命令查看当前变量值


 --------------------------------
一些编译错误处理方法 
brew install md5sha1sum
brew install wget


./compile.sh: line 303: ./gradlew: Permission denied 问题:
https://blog.csdn.net/mq2553299/article/details/78754020

chmod +x gradlew
 ./gradlew
 
--------------------------------
 Android NDK
 download the NDK r14b for Linux/Mac.
 Android NDK下载(r10d r13b r14b)  https://blog.csdn.net/momo0853/article/details/73898066
 
 android-ndk-r14b-darwin-x86_64.zip
 
 --------------------------------
 
 使用Git下载VLC-Android代码,如果未安装Git,请先执行apt-get install git

git clone https://code.videolan.org/videolan/vlc-android.git
 
 --------------------------------
 环境变量设置

export ANDROID_SDK=/Users/andyli/Library/Android/sdk
export ANDROID_NDK=/Users/andyli/mydoc/OpenProject/android-ndk-r14b
export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools


编译
./compile.sh -a arm64
其中'-a'的可选有arm,arm64,x86,x86_64,mips,mips64,如果缺省参数,则默认为arm


单独编译VLC库
./compile-libvlc.sh -a arm64

 --------------------------------
local.properties
sdk.dir=/Users/andyli/Library/Android/sdk
ndk.dir=/Users/andyli/mydoc/OpenProject/android-ndk-r14b

 --------------------------------
 
 Android Studio -使用 Gradle打包多版本APK——buildTypes和productFlavors
 https://blog.csdn.net/xx326664162/article/details/48467343
 
Android Studio中的productFlavors指定默认编译执行的任务
https://blog.csdn.net/fly_yuge/article/details/52229501

 --------------------------------
 
vlc-android/build.gradle   
revision() 同步错误 Process 'command 'git'' finished with non-zero exit value 128

def revision() {
    def code = new ByteArrayOutputStream()
    exec {
        commandLine 'git', 'rev-parse', '--short', 'HEAD'
        standardOutput = code
    }
    return code.toString()
}

以上出错是因为没有git commit。如果不需要git,可以如下处理:

def revision() {

    return '3.0.x‘
    /*
    def code = new ByteArrayOutputStream()
    exec {
        commandLine 'git', 'rev-parse', '--short', 'HEAD'
        standardOutput = code
    }
    return code.toString()
    */
}
 
 
关于git命令“git rev-parse --short HEAD”在android studio中使用与配置的个人探究
https://blog.csdn.net/y97524027/article/details/52690077

Mac环境下使用Android Studio配置GIT
https://blog.csdn.net/a709314090/article/details/52089858

Android Studio取消关联Git
https://blog.csdn.net/lyj1005353553/article/details/55519487

 --------------------------------
android studio打包方式
https://blog.csdn.net/teamomylife/article/details/70224929


动态设置一些额外信息

把当前的编译时间、编译的机器、最新的commit版本添加到apk

android { 
  defaultConfig { 
      resValue "string", "build_time", buildTime() 
      resValue "string", "build_host", hostName() 
      resValue "string", "build_revision", revision() 
  }
}


def buildTime() { 
      return new Date().format("yyyy-MM-dd HH:mm:ss")
}


def hostName() { 
      return System.getProperty("user.name") + "@" + InetAddress.localHost.hostName
}


def revision() { 
      def code = new ByteArrayOutputStream() 
      exec { 
        commandLine 'git', 'rev-parse', '--short', 'HEAD' 
        standardOutput = code 
      } 
      return code.toString()
}
上述代码实现了动态的添加了3个字符串资源: build_time、build_host、build_revision, 然后在其他地方可像如引用字符串一样使用如下:


// 在Activity里调用
getString(R.string.build_time) // 输出编译时间,如:2016-09-07 17:01
getString(R.string.build_host) // 输出电脑的用户名和PC

getString(R.string.build_revision) // 输出3dd5823, 这是最后一次commit的sha值

 --------------------------------

 Mac find 命令  https://blog.csdn.net/sulinux/article/details/51916338
 

mac中通过find查找apk:

vlc-android-master-3.x andyli$ find ./ -name "*.apk"

.//vlc-android/build/outputs/apk/vanillaARMv8/debug/VLC-Android-3.0.5-ARMv8.apk



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值