Android NDK:正在中止。停止

时间:2014-03-21 09:13:52

标签: android c++ android-ndk ffmpeg shared-libraries

我试图在C++编码中调用Java方法。

我在定义Android NDK : Aborting. Stop文件时收到了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    := ffmpeg
LOCAL_SRC_FILES := ffmpeg.cpp
LOCAL_SHARED_LIBRARIES := ffmpeg
include $(BUILD_SHARED_LIBRARY) 

但如果我这样定义,它会成功运行:

LOCAL_PATH := $(call my-dir)

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

include $(BUILD_SHARED_LIBRARY)

Questions

1 - 如何解决此错误?

2 - 在Android.mk文件中,无法同时拨打libs/ffmpeg.soffmpeg.cpp

知道这一点的人,

请告诉我,

谢谢,

p / s:项目结构:

enter image description here

1 个答案:

答案 0 :(得分:0)

看到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)

结果将对我有所帮助:

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