1、下载android-ndk-r9
2、在android-ndk-r9\samples\下创建lame\jni文件夹
3、下载lame源码 地址:http://lame.sourceforge.net/download.php
4、源码解压,将libmp3lame文件夹、include中lame.h和lame_intrin.h复制到jni文件夹下
5、删除libmp3lame文件夹下的Makefile.am、Makefile.in、logoe.ico、文件夹i386、vector
6、将jni/util.h中的extern ieee754_float32_t fast_log2(ieee754_float32_t x);替换成extern float fast_log2(float x);
7、将 set_get.h中的#include <lame.h>改为#include "lame.h"
8、在jni文件夹下创建Android.mk,内容为:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libmp3lame
LOCAL_SRC_FILES := \
./libmp3lame/bitstream.c \
./libmp3lame/encoder.c \
./libmp3lame/fft.c \
./libmp3lame/gain_analysis.c \
./libmp3lame/id3tag.c \
./libmp3lame/lame.c \
./libmp3lame/mpglib_interface.c \
./libmp3lame/newmdct.c \
./libmp3lame/presets.c \
./libmp3lame/psymodel.c \
./libmp3lame/quantize.c \
./libmp3lame/quantize_pvt.c \
./libmp3lame/reservoir.c \
./libmp3lame/set_get.c \
./libmp3lame/tables.c \
./libmp3lame/takehiro.c \
./libmp3lame/util.c \
./libmp3lame/vbrquantize.c \
./libmp3lame/VbrTag.c \
./libmp3lame/version.c
LOCAL_LDLIBS := -llog
LOCAL_CFLAGS = -DSTDC_HEADERS
include $(BUILD_SHARED_LIBRARY)
9、LameJni目录下ndk-build,生成so