Thursday, May 9, 2013

How to compile libogg for Android

To compile libogg for Android, you just need to create an appropriate jni/Android.mk makefile with the minimum set of files and options needed to compile libogg for Android.

  1. Download ogg from http://downloads.xiph.org/releases/ogg/ (for example I downloaded libogg-1.1.4.tar.gz)
  2. untar the file in your local directory:

    $ tar zxf libogg-1.1.4.tar.gz
  3. create a jni directory and put the following text into a file named jni/Android.mk:

    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)
    LOCAL_MODULE    := ogg
    LOCAL_CFLAGS    := \
        -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT="" -UHAVE_CONFIG_H \
        -D_ANDROID
    LOCAL_C_INCLUDES := \
        ../libogg-1.1.4/include
    LOCAL_SRC_FILES := \
        ../libogg-1.1.4/src/bitwise.c \
        ../libogg-1.1.4/src/framing.c
    include $(BUILD_SHARED_LIBRARY)
  4.  Now your directory should look like the following:

    $ ls
    jni/  libogg-1.1.4/  libogg-1.1.4.tar.gz
  5. change directory to jni and run ndk-build:

    $ cd jni; ndk-build V=1
That should do it.

2 comments:

  1. Danilo, Can you post a skelleton project on android studio with this content?

    ReplyDelete
    Replies
    1. Ricardo,

      sorry but I'm not familiar with Android studio.

      Delete

Note: Only a member of this blog may post a comment.