Skip to content
Haruki Hasegawa edited this page Jan 31, 2017 · 3 revisions

Building from source

  1. Prerequisites

Install the following softwares on your computer.

  • git
  • cmake
  • Android SDK (r21)
  • Android NDK (r9d+)
  • Android Studio or ADT (Eclipse)

If you are trying to build on Windows machine, please refer to "for Windows users" section.

  1. Obtain source code

Open terminal and input the following commands.

# clone repository
git clone https://github.com/h6ah4i/android-openslmediaplayer.git
cd h6ah4i-android-openslmediaplayer

# clone submodules
git submodule init
git submodule update

# change shell program (NOTE: this step is only required for Windows user)
bash

# download third party libraries
./library/src/main/dep_libs/cxxdasp/android/dep_libs/download_dep_libs.sh

3-A. for Android Studio user (Java + Native API examples)

  1. Import Non-Android Studio project -> Select [repository]/android-studio/OpenSLMediaPlayer directory
  2. Open local.properties file and append the following line
    ndk.dir=[path to ndk installed directory]
    
  3. Build -> Make Project

3-B. for ADT user (Java API example)

  1. Import android-suport-v7-appcompat and android-suport-v7-gridlayour libraries

    1. File -> Import...
    2. Select "Existing Android Code into Workspace" and click Next
    3. Specify [android sdk]/extras/android/support/v7
    4. Select the following projects to import
      • appcompat (android-suport-v7-appcompat)
      • gridlayout (android-suport-v7-gridlayout)
    5. Check "Copy projects into workspace"
    6. Click "Finish"
  2. Import OpenSLMediaPlayer projects

    1. File -> Import...
    2. Select "Existing Projects into Workspace" and click Next
    3. Specify top directory of the cloned this repository
    4. Select the following projects to import
      • OpenSLMediaPlayer
      • OpenSLMediaPlayerExample
      • OpenSLMediaPlayerTest
    5. Uncheck "Copy projects into workspace"
    6. Click "Finish"
  3. Fix project property

    1. Open properties dialog of the OpenSLMediaPlayerExample project
    2. Fix reference errors of android-suport-v7-appcompat and android-suport-v7-gridlayout
  4. Project -> Build All

3-C. for ADT user (Native API example)

  1. Import OpenSLMediaPlayerNativeAPIExample project

    1. File -> Import...
    2. Select "Existing Projects into Workspace" and click Next
    3. Specify top directory of the cloned this repository
    4. Select the following project to import
      • OpenSLMediaPlayerNativeAPIExample
    5. Click "Finish"
  2. Project -> Build All

[IMPORTANT] for Windows users

  • I recommend to use cmder (full version) for terminal app and GNU make can be downloaded from here. (put make.exe into the cmder/bin directory)

  • Avoid deep path name place or use subst command

    Gnu make and compiler (maybe other mingw commands) affects MAX_PATH (=260 chars) limitation

    SUBST X: C:\media\android-openslmediaplayer

  • ADT is not recommended, please use Android Studio.

    I have tried to import and build with ADT on Windows, but I was not able to build properly. Eclipse seemed be hanged up during the build sequence because ndk-build (make.exe) process was never stopped even after finished to create .so files. I don't know what's wrong, but the above procedure works on Linux and OS X.