How to play mp3 files using sonic ndk in Android?


I am using Sonic Ndk in my app to play audio from this sample but it can't play mp3 files.

Android NDK has no such apis. but there are several solutions for play mp3 in ndk.

  1. You can use MediaPlayer platform api. See

    But, it is not public api and it can be broken by manufacturer.

  2. You can use OpenMAX AL interface. Recently, ndk support OpenMAX AL.

    But, it is very difficult to use, and few references. :(

    And only support api level 14 or above.

  3. You can call java method in jni.

    You can see how call java method in c/c++ source in below source.

    I think this is better solution than others.