【问题标题】:error: use of undeclared identifier 'AMediaCodec_releaseOutputBuffer' (Android NDK)错误:使用未声明的标识符“AMediaCodec_releaseOutputBuffer”(Android NDK)
【发布时间】:2020-08-05 01:21:04
【问题描述】:

我收到这些 NDK 函数的未定义错误:

 In file included from /home/user/orwell2/myapp_flutter_app/android/app/src/main/cpp/MediaCodecDecoder.cpp:5:
  /home/user/myapp3/myapp_flutter/android/app/src/main/cpp/MediaCodecDecodedFrame.h:24:3: error: use of undeclared identifier 'AMediaCodec_releaseOutputBuffer'
                  AMediaCodec_releaseOutputBuffer(aMediaCodec, outputBufferIndex, false);
                  ^
  /home/user/myapp3/myapp_flutter/android/app/src/main/cpp/MediaCodecDecoder.cpp:31:22: error: use of undeclared identifier 'AMediaFormat_new'; did you mean 'AMediaFormat'?
          format.reset(AMediaFormat_new());
                       ^
  /home/user/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/media/NdkMediaFormat.h:47:29: note: 'AMediaFormat' declared here
  typedef struct AMediaFormat AMediaFormat;
                              ^

但我包含了它的标题:

#include "media/NdkMediaFormat.h"
#include "media/NdkMediaMuxer.h"
#include "media/NdkMediaCodec.h"
#include "media/NdkMediaExtractor.h"

我没有包含错误。我正在构建 Android Studio。以前可以,现在不行了。我不知道是什么原因造成的。

我也试过

#include <NdkImage.h>
#include <NdkImageReader.h>
#include <NdkMediaCodec.h>
#include <NdkMediaCrypto.h>
#include <NdkMediaDrm.h>
#include <NdkMediaError.h>
#include <NdkMediaExtractor.h>
#include <NdkMediaFormat.h>
#include <NdkMediaMuxer.h>

就像这里所说的:https://developer.android.com/ndk/reference/group/media 但它不起作用。

我的 NDK 版本是 21.3.6528147

    minSdkVersion 18
    targetSdkVersion 28

我也试过ndk 21.1.6352462

【问题讨论】:

    标签: android c++ android-ndk


    【解决方案1】:

    解决方案:将最低 sdk 版本提高到 21,因为这是插入这些函数的地方

        minSdkVersion 21
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-12
      • 2014-08-04
      相关资源
      最近更新 更多