Android NDK:中止停止?

时间:2014-03-20 08:11:14

标签: android c++ android-ndk makefile ffmpeg

我正在研究ffmpeg for android。我已经成功编译了ffmpeg-2.0.1          之后我在NDK的源码/ ffmpeg-2.0.1 / android / arm中制作Android.mk文件

      LOCAL_PATH:= $(call my-dir)

      include $(CLEAR_VARS)

      LOCAL_MODULE:= libavcodec

      LOCAL_SRC_FILES:= lib/libavcodec-55.so

       LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

      include $(PREBUILT_SHARED_LIBRARY)

之后使android项目和android项目中的Android.mk文件为

  LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

   LOCAL_MODULE    := tutorial01
   LOCAL_SRC_FILES := tutorial01.c
   LOCAL_LDLIBS := -llog -ljnigraphics -lz 
   LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil

   include $(BUILD_SHARED_LIBRARY)
    $(call import-module,ffmpeg-2.0.1/android/arm)

但显示问题

 *** Android NDK: Aborting    .  Stop.
   android-ffmpeg-tutorial01line 45, external location: 
   /home/tech/Documents/roman10/ndk/android-ndk-r9c/build/core/prebuilt-library.mk
   C/C++ Problem

我的NDK是android-ndk-r9c,系统是ubuntu-13.04,请有人指导我。

提前感谢。

2 个答案:

答案 0 :(得分:7)

首先查看Android.mk structure

需要更改Android.mk文件,如下所示:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := ffmpeg
LOCAL_SRC_FILES := libs/ffmpeg.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := final_ffmpeg
LOCAL_SRC_FILES := ffmpeg.cpp
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
LOCAL_PREBUILTS := libs/ffmpeg.so
#libavformat libavcodec libswscale libavutil
include $(BUILD_SHARED_LIBRARY)

p / s: 在将数据放在一起时,我也会遇到Android NDK : Aborting问题:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE:= ffmpeg
LOCAL_SRC_FILES:= libs/ffmpeg.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := ffmpeg
LOCAL_SRC_FILES := ffmpeg.cpp
LOCAL_SHARED_LIBRARIES := ffmpeg
include $(BUILD_SHARED_LIBRARY)

LOCAL_MODULE 名称重复时会发生此问题。

结果将对您有所帮助:

您仍然需要call the C++ function in C++ file from Java file

答案 1 :(得分:0)

当我尝试使用NDK64-Linux-r10构建HelloComputeNDK示例时,我遇到了类似的问题。

然后我注意到NDK64-Linux-r10只有Android-L平台,所以我下载了NDK32-Linux-R10,并将它与NDK64-Linux-r10合并。

对我来说很顺利。

你可以在这里下载NDK32-Linux-r10: https://developer.android.com/tools/sdk/ndk/index.html