Difference between revisions of "AndroidCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
(Add debug tools)
Line 1: Line 1:
This page is an introduction to compilation of VLC for Android on Linux.
+
This page is an introduction to compilation of VLC for Android on Linux.  
  
= Eclipse, SDK and NDK installation =
+
= Eclipse, SDK and NDK installation =
  
== Android SDK ==
+
== Android SDK ==
  
# Create a working directory ''android''.
+
#Create a working directory ''android''.  
# Go to [http://developer.android.com/sdk/index.html Android SDK page] and download android-sdk_r10-linux_x86.tgz.
+
#Go to [http://developer.android.com/sdk/index.html Android SDK page] and download android-sdk_r10-linux_x86.tgz.  
# Decompress into ''android'' folder.
+
#Decompress into ''android'' folder.  
# Run ''tools/android''.
+
#Run ''tools/android''.  
# In the tool, install '''"SDK Platform Android 2.3, API 10"''', and follow the instructions.
+
#In the tool, install '''"SDK Platform Android 2.3, API 10"''', and follow the instructions.
  
You can have [http://developer.android.com/sdk/installing.html more details], if needed.
+
You can have [http://developer.android.com/sdk/installing.html more details], if needed.  
  
 +
<br>
  
== Android NDK ==
+
== Android NDK ==
  
# Check that the SDK installation is correct.
+
#Check that the SDK installation is correct.  
# Go to [http://developer.android.com/sdk/ndk/index.html Android NDK page].
+
#Go to [http://developer.android.com/sdk/ndk/index.html Android NDK page].  
# Download http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2.
+
#Download http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2.  
# Decompress into ''android'' folder, next to your android-sdk-linux_x86 folder.
+
#Decompress into ''android'' folder, next to your android-sdk-linux_x86 folder.
  
 +
<br>
  
== Eclipse ==
+
== Eclipse ==
As used by your distribution, install eclipse with your package manager:
+
 
 +
As used by your distribution, install eclipse with your package manager:  
  
 
  apt-get install eclipse (debian)
 
  apt-get install eclipse (debian)
Line 31: Line 34:
 
  ...
 
  ...
  
And run it, at least once, and then quit eclipse.
+
And run it, at least once, and then quit eclipse.  
 +
 
 +
=== ADT  ===
  
=== ADT ===
+
The '''ADT''' plugin is required to compile on Android.
  
The '''ADT''' plugin is required to compile on Android.
+
#Go to [http://developer.android.com/sdk/eclipse-adt.html#installing ADT page].
 +
#Start Eclipse, then select Help &gt; Install New Software....
 +
#Add the "ADT Plugin" repository with https://dl-ssl.google.com/android/eclipse/ as '''URL'''  
 +
#Validate and select the checkbox next to Developer Tools and click Next, Next, Finish.
 +
#Restart Eclipse.
 +
#Go to ''Menu'' &gt; ''Window'' &gt; ''Preferences...'' and then ''Android'' from the left pane.
 +
#Point the SDK Location in to your downloaded SDK directory.
 +
#Ok, and quit Eclipse.
  
# Go to [http://developer.android.com/sdk/eclipse-adt.html#installing ADT page].
+
See [http://developer.android.com/sdk/eclipse-adt.html#troubleshooting extra information here].  
# Start Eclipse, then select Help > Install New Software....
 
# Add the "ADT Plugin" repository with https://dl-ssl.google.com/android/eclipse/ as '''URL'''
 
# Validate and select the checkbox next to Developer Tools and click Next, Next, Finish.
 
# Restart Eclipse.
 
# Go to ''Menu'' > ''Window'' > ''Preferences...'' and then ''Android'' from the left pane.
 
# Point the SDK Location in to your downloaded SDK directory.
 
# Ok, and quit Eclipse.
 
  
See [http://developer.android.com/sdk/eclipse-adt.html#troubleshooting extra information here].
+
== Environment setup  ==
  
== Environment setup ==
+
Be sure to have installed ''git'' and the usual build tools, like ''autotools'', or ''gcc''.
  
Be sure to have installed ''git'' and the usual build tools, like ''autotools'', or ''gcc''.
+
Set $ANDROID_SDK to point to your android SDK directory
  
Set $ANDROID_SDK to point to your android SDK directory
 
 
  export ANDROID_SDK=/path/to/android-sdk
 
  export ANDROID_SDK=/path/to/android-sdk
  
Set $ANDROID_NDK to point to your android NDK directory
+
Set $ANDROID_NDK to point to your android NDK directory  
 +
 
 
  export ANDROID_NDK=/path/to/android-ndk
 
  export ANDROID_NDK=/path/to/android-ndk
  
Add some useful binaries in your path
+
Add some useful binaries in your path  
 +
 
 
  export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
 
  export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools
  
If you plan to use the emulator, you need a build without neon
+
If you plan to use the emulator, you need a build without neon  
 +
 
 
  export NO_NEON=1
 
  export NO_NEON=1
  
Those exports must be set at all times, notably for the contribs and the configure.
+
Those exports must be set at all times, notably for the contribs and the configure.  
  
= Get VLC Source =
+
= Get VLC Source =
  
Use the VLC git repository to get the source!
+
Use the VLC git repository to get the source!  
 +
 
 +
In your ''android'' folder, run:
  
In your ''android'' folder, run:
 
 
  git clone git://git.videolan.org/vlc/vlc-android.git
 
  git clone git://git.videolan.org/vlc/vlc-android.git
  
== Contribs ==
+
== Contribs ==
 +
 
 +
We need 3rd party libraries. We will fetch them from the Internetz.
  
We need 3rd party libraries. We will fetch them from the Internetz.
 
 
  cd extras/contrib
 
  cd extras/contrib
 
  ./bootstrap -t arm-eabi -d android
 
  ./bootstrap -t arm-eabi -d android
Line 81: Line 90:
 
  cd -
 
  cd -
  
This '''will''' take time. This is perfectly normal.
+
This '''will''' take time. This is perfectly normal.  
 +
 
 +
== Configure VLC  ==
  
== Configure VLC ==
+
Run:
  
Run:
 
 
  ./bootstrap
 
  ./bootstrap
  
If this step fails, you are missing some build tools. See [[Compile]].
+
If this step fails, you are missing some build tools. See [[Compile]].  
  
 
  mkdir build
 
  mkdir build
Line 94: Line 104:
 
  ../extras/package/android/configure.sh
 
  ../extras/package/android/configure.sh
  
== Compile VLC ==
+
== Compile VLC ==
 +
 
 +
Just run:
  
Just run:
 
 
  ./compile -k
 
  ./compile -k
  
== Package VLC ==
+
== Package VLC ==
 +
 
 +
=== JNI  ===
  
=== JNI ===
+
Build the JNI interface for libvlc  
Build the JNI interface for libvlc
 
  
 
  cd ../extras/package/android
 
  cd ../extras/package/android
 
  VLC_BUILD_DIR=../../../build VLC_CONTRIB=../../contrib make
 
  VLC_BUILD_DIR=../../../build VLC_CONTRIB=../../contrib make
  
=== Package in eclipse ===
+
=== Package in eclipse ===
# In Eclipse, create a new Android project from existing source by giving the extra/platform/android/vlc-android path.
+
 
# Compile your project using Eclipse.
+
#In Eclipse, create a new Android project from existing source by giving the extra/platform/android/vlc-android path.  
 +
#Compile your project using Eclipse.
 +
 
 +
<br>
 +
 
 +
== Run  ==
 +
 
 +
Run it and enjoy!
  
 +
== Debug<br>  ==
  
== Run ==
+
[http://developer.android.com/guide/developing/debugging/ddms.html DDMS]
Run it and enjoy!
 
  
== Debug ==
+
[http://developer.android.com/guide/developing/tools/logcat.html Logcat]
...
 

Revision as of 00:27, 10 May 2011

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

Eclipse, SDK and NDK installation

Android SDK

  1. Create a working directory android.
  2. Go to Android SDK page and download android-sdk_r10-linux_x86.tgz.
  3. Decompress into android folder.
  4. Run tools/android.
  5. In the tool, install "SDK Platform Android 2.3, API 10", 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.
  3. Download http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2.
  4. Decompress into android folder, next to your android-sdk-linux_x86 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.

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

Be sure to have installed git and the usual build tools, like autotools, or gcc.

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 in your path

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

If you plan to use the emulator, you need a build without neon

export NO_NEON=1

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

Get VLC Source

Use the VLC git repository to get the source!

In your android folder, run:

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

Contribs

We need 3rd party libraries. We will fetch them from the Internetz.

cd extras/contrib
./bootstrap -t arm-eabi -d android
make
cd -

This will take time. This is perfectly normal.

Configure VLC

Run:

./bootstrap

If this step fails, you are missing some build tools. See Compile.

mkdir build
cd build
../extras/package/android/configure.sh

Compile VLC

Just run:

./compile -k

Package VLC

JNI

Build the JNI interface for libvlc

cd ../extras/package/android
VLC_BUILD_DIR=../../../build VLC_CONTRIB=../../contrib make

Package in eclipse

  1. In Eclipse, create a new Android project from existing source by giving the extra/platform/android/vlc-android path.
  2. Compile your project using Eclipse.


Run

Run it and enjoy!

Debug

DDMS

Logcat