mediaNdk 未定义引用 'AMediaCodec_signalEndOfInputStream'

mediaNdk undefined reference to 'AMediaCodec_signalEndOfInputStream'

在 link 进程上找不到 AMediaCodec_signalEndOfInputStream

ExportThread.cpp 来源

configure file

apilevel android-21

这是我的配置

CmakeLists.txt

target_link_libraries(${Lib_Name}

                       android
                       mediandk
                       EGL
                       GLESv3
                       log )

gradle.build

        ndk {
            abiFilters 'armeabi-v7a'
//            , 'armeabi-v7a', 'arm64-v8a'
        }
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_PLATFORM=android-21'
            }
        }

错误

[35/35] Linking CXX shared library /Users/rqg/ASProjects/PboTest/muses/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so
  FAILED: : && /Users/rqg/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/Users/rqg/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/rqg/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/rqg/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -std=c++11 -frtti -fexceptions -Wall -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a --sysroot /Users/rqg/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o /Users/rqg/ASProjects/PboTest/muses/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so CMakeFiles/native-lib.dir/DecodeThread.cpp.o CMakeFiles/native-lib.dir/DelayThread.cpp.o CMakeFiles/native-lib.dir/EffectLine.cpp.o CMakeFiles/native-lib.dir/EffectManager.cpp.o CMakeFiles/native-lib.dir/ExportThread.cpp.o CMakeFiles/native-lib.dir/NativeSurfaceTexture.cpp.o CMakeFiles/native-lib.dir/Painter.cpp.o CMakeFiles/native-lib.dir/PboPool.cpp.o CMakeFiles/native-lib.dir/Player.cpp.o CMakeFiles/native-lib.dir/PrepareThread.cpp.o CMakeFiles/native-lib.dir/RenderManager.cpp.o CMakeFiles/native-lib.dir/RenderTask.cpp.o CMakeFiles/native-lib.dir/effect/BlurEffect.cpp.o CMakeFiles/native-lib.dir/effect/BoostEffect.cpp.o CMakeFiles/native-lib.dir/effect/ChaplinEffect.cpp.o CMakeFiles/native-lib.dir/effect/Effect.cpp.o CMakeFiles/native-lib.dir/effect/FadeEffect.cpp.o CMakeFiles/native-lib.dir/effect/NormalEffect.cpp.o CMakeFiles/native-lib.dir/framesource/IFrameSource.cpp.o CMakeFiles/native-lib.dir/framesource/ImageFrameSource.cpp.o CMakeFiles/native-lib.dir/framesource/VideoFrameSource.cpp.o CMakeFiles/native-lib.dir/gl/EglCore.cpp.o CMakeFiles/native-lib.dir/gl/surface/EglSurfaceBase.cpp.o CMakeFiles/native-lib.dir/gl/surface/OffscreenSurface.cpp.o CMakeFiles/native-lib.dir/gl/surface/WindowSurface.cpp.o CMakeFiles/native-lib.dir/native-lib.cpp.o CMakeFiles/native-lib.dir/render/BlurRender.cpp.o CMakeFiles/native-lib.dir/render/FadeRender.cpp.o CMakeFiles/native-lib.dir/render/NormalRender.cpp.o CMakeFiles/native-lib.dir/render/PolygonOffsetRenderer.cpp.o CMakeFiles/native-lib.dir/render/Render.cpp.o CMakeFiles/native-lib.dir/util/DelayLooper.cpp.o CMakeFiles/native-lib.dir/util/Looper.cpp.o CMakeFiles/native-lib.dir/util/common.cpp.o  -landroid -lmediandk -lEGL -lGLESv3 -llog -lm "/Users/rqg/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" && :
  /Users/rqg/ASProjects/PboTest/muses/src/main/cpp/ExportThread.cpp:37: error: undefined reference to 'AMediaCodec_signalEndOfInputStream'
  /Users/rqg/ASProjects/PboTest/muses/src/main/cpp/ExportThread.cpp:107: error: undefined reference to 'AMediaCodec_createInputSurface'
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

这是 NDK r.15 中的错误。这个API是在android-26才引入的。顺便说一句,您可以依靠 Android Studio 将 -DANDROID_PLATFORM 设置为对应于 build.gradle.[=12= 中选择的 minSdkVersion ]