Android NDK:中止停止?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22526992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:08:09  来源:igfitidea点击:

Android NDK: Aborting stop?

androidc++android-ndkmakefileffmpeg

提问by Sandeep Tiwari

I am working on ffmpeg for android. I have successfully compile ffmpeg-2.0.1 after that I make Android.mk file in my NDK's sources/ffmpeg-2.0.1/android/arm as

我正在为 android 开发 ffmpeg。我已经成功编译了 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)

After that make android project and in android project Android.mk file is as

之后制作 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)

but showing a problem

但显示有问题

 *** 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

My NDK is android-ndk-r9c,system is ubuntu-13.04,please anyone guide me.

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

thanks in advance.

提前致谢。

采纳答案by Huy Tower

See the Android.mk structurefirstly.

Android.mk structure第一。

Need change Android.mkfile like this :

需要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 : I also get the Android NDK : Abortingproblem as you when put data together like this :

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)

This problem happens whenLOCAL_MODULEname is duplicated.

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

The result will help you :

结果将帮助您:

It still be exactly when you need call the C++ function in C++ file from Java file.

它仍然是您需要从 Java 文件调用 C++ 文件中的 C++ 函数的时候

回答by Marvin Wang

I run into a similar problem when I tried to build HelloComputeNDK sample with NDK64-Linux-r10.

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

Then I notice that NDK64-Linux-r10 only have Android-L platform, so I download NDK32-Linux-R10, and merge it with NDK64-Linux-r10.

然后发现NDK64-Linux-r10只有Android-L平台,所以下载了NDK32-Linux-R10,和NDK64-Linux-r10合并。

It goes well for me.

对我来说很顺利。

U can download NDK32-Linux-r10 here: https://developer.android.com/tools/sdk/ndk/index.html

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