cropsly / ffmpeg-android

FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+)
http://writingminds.github.io/ffmpeg-android/
Other
1.63k stars 415 forks source link

Static libraries in android project is not useful. #66

Open shenzhiguo opened 7 years ago

shenzhiguo commented 7 years ago

I add libformat.a library in my apk, but it can't be work! It's report thus erroe. Error:(9) undefined reference to 'av_register_all()'. The project use ndk-14 and cmake to compile.CMakeLists.txt like this.

cmake_minimum_required(VERSION 3.4.1)

set(DISTRIBUTION_DIR ${CMAKE_SOURCE_DIR}/../distribution)

# link_directories( ${DISTRIBUTION_DIR}/${ANDROID_ABI}/lib )

add_library( avformat
             STATIC
             IMPORTED )

set_target_properties( avformat
                       PROPERTIES IMPORTED_LOCATION
                       ${DISTRIBUTION_DIR}/${ANDROID_ABI}/lib/libavformat.a)

include_directories( ${DISTRIBUTION_DIR}/${ANDROID_ABI}/include )

add_library( native-lib
             SHARED
             src/main/cpp/native-lib.cpp )

find_library( log-lib
              log )

target_link_libraries( native-lib
                       avformat
                       ${log-lib} )

Did I do something wrong? I use readelf command to read symbols in libformat.a file, av_register_all exsit in there. I don‘t understand why it is wrong!