build VCL on android

2023-11-18

转自:http://wiki.videolan.org/AndroidCompile

AndroidCompile

This page is an introduction to the compilation of VLC for Android on Linux.

Contents

 [hide

Eclipse, SDK and NDK installation

Requirements

  • You MUST be on Linux, and a recent one; or OSX.
  • You MUST have installed: apache-ant (or ant), autopointgawk (or nawk), gccg++patchsubversion, and very up-to-date versions of those tools.
    • Special note: Additionally, if you are compiling for an Android-x86 device, you should install yasm.
  • You MUST install: git.

Android SDK

  1. Create a working directory android.
  2. Go to Android SDK page and download the latest SDK for linux.
  3. Decompress into android folder.
  4. Run tools/android (from the command line you can also run: "tools/android update sdk -u -t platform,platform-tool,extra")
  5. In the tool, install "SDK Platform Android 4.0, API 17", and follow the instructions.

You can have more details, if needed.

Android NDK

  1. Check that the SDK installation is correct.
  2. Go to Android NDK page and download the NDK r8b for Linux.
  3. Decompress into android folder, next to your android-sdk-linux folder.

Eclipse

As used by your distribution, install Eclipse with your package manager:

apt-get install eclipse (debian)
yum install eclipse (Fedora)
pacman -S eclipse (Arch)
emerge -av eclipse-sdk (Gentoo)
...

And run it, at least once, and then quit eclipse.

Note: On Debian-based distributions it is better to download Eclipse indigo builds from the official website: http://www.eclipse.org/downloads/, otherwise it can lead to an error when importing the ADT plugin (see following).

ADT

The ADT plugin is required to compile on Android.

  1. Go to ADT page.
  2. Start Eclipse, then select Help > Install New Software....
  3. Add the "ADT Plugin" repository with https://dl-ssl.google.com/android/eclipse/ as URL
  4. Validate and select the checkbox next to Developer Tools and click Next, Next, Finish.
  5. Restart Eclipse.
  6. Go to Menu > Window > Preferences... and then Android from the left pane.
  7. Point the SDK Location in to your downloaded SDK directory.
  8. Ok, and quit Eclipse.

See extra information here.

Environment setup

Set $ANDROID_SDK to point to your Android SDK directory

export ANDROID_SDK=/path/to/android-sdk

Set $ANDROID_NDK to point to your Android NDK directory

export ANDROID_NDK=/path/to/android-ndk

Add some useful binaries to your $PATH

export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools

Devices

You need to export the ABI for your device. armeabi-v7a is for devices with ARMv7 or above (regardless of NEON), any other ARM device uses armeabi, x86/Intel devices use x86.

export ANDROID_ABI=armeabi-v7a

or

export ANDROID_ABI=armeabi

For a build that will run on x86 Android devices (e.g. certain Intel Android smartphones):

export ANDROID_ABI=x86

For a build that will run on MIPS devices (i.e. Ainol Novo tablets):

export ANDROID_ABI=mips

The following flags (NEON, FPU, ARMV6) are relevant only for the armeabi ABI:

If you plan to use an armeabi device that does not support FPU, you need a build without FPU

export NO_FPU=1

If you plan to use an ARMv5 armeabi device (read: Android Emulator), you need a build without ARMv6

export NO_ARMV6=1

Examples

  • For a normal (2012 consumer phone or tablet), like Cortex-A8 or Cortex-A9
export ANDROID_ABI=armeabi-v7a
  • For a Tegra2 device
export ANDROID_ABI=armeabi-v7a
  • For an ARMv6 device
export ANDROID_ABI=armeabi
  • For an ARMv6 device without FPU
export ANDROID_ABI=armeabi
export NO_FPU=1
  • For an ARMv5 device or the emulator
export ANDROID_ABI=armeabi
export NO_ARMV6=1
  • For a x86 device (e.g. Android-x86, Google TV, Logitech TV, etc)
export ANDROID_ABI=x86
  • For a MIPS device (i.e. Ainol Novo tablets):
export ANDROID_ABI=mips

Those exports must be set at all times, notably for the contribs and the configure.

Building

Get VLC Source

Clone the source from the VLC git!

In your android folder, run:

git clone git://git.videolan.org/vlc-ports/android.git


Compile

Read compile.sh first, as it contains some very useful and important information. Then run it:

sh compile.sh

Note: At this point, you will get an autogenerated debug apk in the bin/ folder, signed with a debug key.

In order to build a non-debug package:

sh compile.sh release

Note: At this point, you will get an unsigned release apk in the bin/ folder, which you will have to sign and zipalign.

Package in Eclipse [optional]

  1. In Eclipse, create a new Android Project from existing source by importing from the vlc-android path.
  2. Export unsigned/signed apk.

Note: Building against JDK6 is recommended for optimal compatibility (Set Java Compiler Compliance to 1.6).

Run

Run it and enjoy!

Debugging

Here are some helpful links if you wish to debug VLC on Android:

Native debugging

If you run VLC Android and you get a crash that looks something like this:

I/DEBUG   (  958): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  958): Build fingerprint: 'MOTO/MBTCA/sesame/XT300:2.1-update1/SESLA_U3_01.71.0/110110:user/release-keys'
I/DEBUG   (  958): pid: 1733, tid: 1733 >>> org.videolan.vlc <<<
I/DEBUG   (  958): signal 11 (SIGSEGV), fault addr 4237be3c
I/DEBUG   (  958):  r0 423640a0  r1 7ece77ac  r2 42bccdac  r3 4237be38
I/DEBUG   (  958):  r4 00000000  r5 42bccdac  r6 002ed088  r7 002ed018
I/DEBUG   (  958):  r8 7ece78e8  r9 2bafa844  10 0000000e  fp 7ece794c
I/DEBUG   (  958):  ip 00002ba0  sp 7ece7784  lr 423652e4  pc 4237be3c  cpsr 60000010
I/DEBUG   (  958):          #00  pc 0037be3c  /data/data/org.videolan.vlc/lib/libvlcjni.so
I/DEBUG   (  958):          #01  lr 423652e4  /data/data/org.videolan.vlc/lib/libvlcjni.so

You have a native crash. To debug it, you need to have compiled VLC as above and installed it on your device. Once your compiled VLC build is on your device, you can find the backtraceas follows:

  1. Make sure you are in the directory that you checked out VLC-Android in.
  2. cd vlc-android
  3. $ANDROID_NDK/ndk-gdb --verbose --force --start

At this point, lots of stuff will appear:

Android NDK installation path: /opt/android-ndk-r8c
Using default adb command: /opt/android-sdk-linux_x86/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.29
Using ADB flags: 
Using auto-detected project path: .
Found package name: org.videolan.vlc
...bunch of stuff skipped...
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Remote debugging from host 0.0.0.0
...bunch of stuff skipped...
libthread_db:td_ta_new: Victory: We can debug theads!
warning: Breakpoint address adjusted from 0x400deaa5 to 0x400deaa4.
0x40107a40 in epoll_wait () from /media/data/vlc_android/vlc-android/obj/local/armeabi/libc.so
(gdb)
  1. At this point, type in "continue" and press Enter.
  2. Perform the actions you did to make it crash. It will spit out something like this:
Program received signal SIGSEGV, Segmentation fault.
0x401120ae in ?? () from /media/data/vlc_android/vlc-android/obj/local/armeabi/libc.so
  1. Now, just type in "bt full" (excluding the quotation marks) and press Enter. That is your backtrace that you should give to the developers when they ask for it (possibly on a pastebin, too).
(gdb) bt full
#0  0x401120ae in ?? () from /media/data/vlc_android/vlc-android/obj/local/armeabi/libc.so
No symbol table info available.
#1  0x40107bd8 in abort () from /media/data/vlc_android/vlc-android/obj/local/armeabi/libc.so
No symbol table info available.
#2  0x40118e6a in __assert2 () from /media/data/vlc_android/vlc-android/obj/local/armeabi/libc.so
No symbol table info available.
#3  0x5e0cdfdc in var_SetChecked (p_this=0x40134b94, psz_name=0x5ea2fcb8 "rate", expected_type=80, val=...) at ../../src/misc/variables.c:711
        i_ret = 0
        p_var = <optimized out>
        oldval = {i_int = 4742037487051810480, b_bool = 176, f_float = 2.27765068e+14, psz_string = 0x574f26b0 "X\270|B\001\001", p_address = 0x574f26b0, 
          p_object = 0x574f26b0, p_list = 0x574f26b0, i_time = 4742037487051810480, coords = {x = 1464805040, y = 1104091640}}
        __func__ = "var_SetChecked"
        p_priv = <optimized out>
#4  0x5e06dd9c in var_SetFloat (f=1.41421354, psz_name=0x5ea2fcb8 "rate____sample_backtrace", p_obj=0x0) at ../../include/vlc_variables.h:262
        val = <optimized out>
#5  libvlc_media_player_set_rate (p_mi=0x0, rate=1.41421354) at ../../lib/media_player.c:1252
        p_input_thread = <optimized out>
#6  0x5de7bd18 in Java_org_videolan_vlc_LibVLC_setRate (env=0x41cf0470, thiz=0x8ab00021, rate=1.41421354) at jni/libvlcjni.c:678
        mp = 0x0
#7  0x4076de34 in ?? ()
No symbol table info available.
#8  0x4076de34 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Troubleshooting

Outdated Awk

If you receive the error message while building:

Android NDK: Host 'awk' tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !    

The prebuilt version of Awk that comes with the Android NDK is outdated. Defining HOST_AWK in your environment does nothing as the system still tries to just the one that comes with the Android NDK. To get around this issue, simply rename or delete the Awk binary that comes with the Android NDK. For example to move it:

mv $ANDROID_NDK/prebuilt/linux-x86/bin/awk $ANDROID_NDK/prebuilt/linux-x86/bin/awk.old

Can't find Ant

If you're new to Ant, please be aware that some Linux distributions don't install it in the usual spot as with other programs. Try checking to see if the directory /usr/share/java/apache-ant/bin exists and add it to your path.

Outdated autotools-dev

If you get the following error message you may have have an outdated version of autotools-dev:

 Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized

You may first want to check if your distribution has any available updates for this package. Alternatively, you can manually update your config.guess and config.sub files from here: [1]. These files are typically located in /usr/share/misc on Debian based distributions.

autoreconf: automake failed with exit status: 1

automake: warnings are treated as errors
configure.ac:41: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and will soon be removed.
configure.ac:41: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
configure.ac:41: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.

If you are using Automake 1.13 or higher, you must remove -Werror from vlc/contrib/android/gnutls/configure.ac to continue. (First reported in [2])

See also

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

build VCL on android 的相关文章

  • 应用程序签名机制

    原文链接 http www 2cto com Article 201308 237263 html Android安全机制分析 Android系统是基于Linux内核开发的 因此 Android系统不仅保留和继承了Linux操作系统的安全机
  • 内核篇加载内核模块(Android10)

    一 开发前期准备 本文中使用的是linageOs源码中下载的oneplus3 安卓10内核源码进行研究测试 交叉编译链使用的是linageOs源码中的交叉编译链 lineageOs源码中oneplus3内核源码位置路径 home qiang
  • Android系统源代码的下载与编译

    http www jianshu com p aeaceda41798
  • Android--Recovery模块之恢复出厂设置

    一 在进行详细流程分析之前 先看一下几个重要概念 一 Recovery的工作需要整个软件平台的配合 从架构角度看 有三个部分 1 Main system 用boot img启动的Linux系统 Android的正常工作模式 2 Recove
  • Tensorflow的Bazel编程(二)

    转自 http blog csdn net langb2014 article details 54312697 安装官网 https bazel build versions master docs tutorial Java html
  • Android 系统865虚拟化集成无源码apk示例

    一 环境 高通865虚拟化Android 10 版本 二 具体修改的文件 以集成OppoAnonymousId apk为例 1 新建OppoAnonymousId目录 将apk放到该目录 vendor qcom proprietary pr
  • Android系统运动传感器

    转自 https blog csdn net liang123l article details 53992197 Android平台提供了多种感应器 让你监控设备的运动 传感器的架构因传感器类型而异 重力 线性加速度 旋转矢量 重要运动
  • Ubuntu虚拟机环境搭建Android系统源码编译环境及问题解决方法

    一 获取Android源码网络配置可以访问google 方法一 二 获取Android源码网络配置可以访问google 方法二 三 Ubuntu18 04下更改apt源为阿里云源 四 代理导致网络无法访问时 证书问题的解决方法 五 Ubun
  • android设备外接多个usb摄像头

    转自 https youshaohua com post android device external multiple USB camera 代码访问 OTG USB camera https github com quantum6 A
  • 导入android project到 eclipse 出现Unable to resolve target 'android-8'的错误

    今天导入一个Android的例子程序 出现了Unable to resolve target android 8 的错误 刚开始以为是没导入包或者是phoneGap没配置好 可是折腾了好久还是报错 最后google之后才发现原来是ADK版本
  • android 进程监控 top

    adb shell top h top h Usage top m max procs n iterations d delay s sort column t h m num Maximum number of processes to
  • Logcat 的常用命令说明

    个人认为有一下几个常用命令 adb logcat c 清除所有以前的日志 adb logcat d 这个命令是在时间上倒过来用的 就是你先操作 然后敲这个命令 打出来的log就是你刚操作那段时间的log 而且自动退出log模式 adb lo
  • 【android系统】android系统升级流程分析(二)---update升级包分析

    接下来我们将通过几篇文章来分析update zip包在具体Android系统升级的过程 来理解Android系统中Recovery模式服务的工作原理 今天让我先来分析下升级包update zip 一 目录结构 update zip包的目录结
  • Android Camera高级特性——手动对焦

    转自 https blog csdn net matrix laboratory article details 82871247 Android Camera 系列目录 搭建Camera开发项目 Android Camera API Ca
  • 使用ANT打包Android应用

    转自 http blog csdn net liuhe688 article details 6679879 大家好 今天来分享一下如何使用ANT打包Android应用 通常我们习惯用eclipse来开发Android程序 它会自动帮我们打
  • 使用grep 过滤logcat输出

    转自 http www xmumu com post 2012 02 15 15478732 如何过滤 adb logcat 输出 简介 本文介绍如何在shell 命令行中过滤 adb logcat 输出的几个小技巧 开发当中经常看到别人的
  • Android 13 网络 Adb相关流程深入分析研究

    Android 13 网络 Adb 分析研究 文章目录 Android 13 网络 Adb 分析研究 一 前言 二 默认adb 代码实现 关键 1 修改的目录 2 具体修改 1 在XXX device mk 添加属性 2 设置固定端口号 3
  • android Jar文件的数字签名

    转自 http hubingforever blog 163 com blog static 17104057920118104058241 JAR文件可以用 jarsigner工具或者直接通过 java securityAPI 签名 签名
  • Android SDK Android NDK 官方下载地址

    Android SDK Android NDK 官方下载地址 Android NDK r6b Windows http dl google com android ndk android ndk r6b windows zip Mac OS
  • 如何读取文件的最后一行并解析

    首先需要了解 ifstream 的 seekg函数 它主要是 用于设置在输入流中的位置 file seekg 0 ios end ios beg 从文件头开始计算偏移量 ios end 从文件末尾开始计算偏移量 ios cur 从当前位置开

随机推荐