Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NDK: Aborting stop?

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

      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

  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.

thanks in advance.

like image 990
Sandeep Tiwari Avatar asked Mar 20 '14 08:03

Sandeep Tiwari


People also ask

How do I disable NDK?

go to Android Studio-> Tools -> SDK ManagerUnder SDK tools tab uncheck "NDK", "CMake", "LLDB" and then apply changes. NDK components will be removed.

Is NDK necessary for Android studio?

Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.

What is android NDK VS sdk?

Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more. NDK is a complex and advanced topics.


1 Answers

See the Android.mk structure firstly.

Need change Android.mk file like this :

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 : Aborting problem as you when put data together like this :

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 when LOCAL_MODULE name is duplicated.

The result will help you :

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

like image 139
Huy Tower Avatar answered Sep 25 '22 19:09

Huy Tower