Getting error linker command failed with exit code in NDK

1.3k views Asked by At

Here is my Android.mk file

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := Prebuild_usb1.0
LOCAL_SRC_FILES :=$(TARGET_ARCH_ABI)/libusb-1.0.so
include $(PREBUILT_SHARED_LIBRARY) 

include $(CLEAR_VARS)
LOCAL_MODULE    := Prebuild_ftrScanAPI
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libftrScanAPI.so
include $(PREBUILT_SHARED_LIBRARY) 

include $(CLEAR_VARS)
LOCAL_MODULE    := Prebuild_ftrAnsiSDK
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libftrAnsiSDK.so
include $(PREBUILT_SHARED_LIBRARY) 

include $(CLEAR_VARS)
LOCAL_MODULE    := ftrAnsiSDKAndroidJni
LOCAL_CFLAGS := -D__ANDROID_API__

LOCAL_SRC_FILES := ftrAnsiSDKAndroidJni.cpp
LOCAL_SHARED_LIBRARIES := Prebuild_usb1.0 Prebuild_ftrScanAPI 
Prebuild_ftrAnsiSDK
include $(BUILD_SHARED_LIBRARY)

And my Application.mk looks like

APP_ABI=armeabi armeabi-v7a

I am getting error when i build apk

Error:error: linker command failed with exit code 1 (use -v to see invocation)

And sometime studio throws warning: '__ANDROID_API__' macro redefined

Here is exception

Execution failed for task ':androidHelper:externalNativeBuildDebug'. Build command failed. Error while executing process C:\Users\waqas\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=D:\Androidprojects\androidstudiolatestzongsourceready\POSApp_AV06_STC_BVS\androidHelper\src\main\jni\Android.mk NDK_APPLICATION_MK=D:\Androidprojects\androidstudiolatestzongsourceready\POSApp_AV06_STC_BVS\androidHelper\src\main\jni\Application.mk APP_ABI=mips NDK_ALL_ABIS=mips NDK_DEBUG=1 APP_PLATFORM=android-17 NDK_OUT=D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=D:\Androidprojects\androidstudiolatestzongsourceready\POSApp_AV06_STC_BVS\androidHelper\build\intermediates\ndkBuild\debug\lib D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj/local/mips/libftrAnsiSDKAndroidJni.so} [mips] Compile++ : ftrAnsiSDKAndroidJni <= ftrAnsiSDKAndroidJni.cpp In file included from :333: :4:9: warning: 'ANDROID_API' macro redefined [-Wmacro-redefined]

define ANDROID_API 17

    ^

:3:9: note: previous definition is here

define ANDROID_API 1

    ^

1 warning generated. [mips] SharedLibrary : libftrAnsiSDKAndroidJni.so D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj/local/mips/libusb-1.0.so: error adding symbols: File in wrong format clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) make:[D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj/local/mips/libftrAnsiSDKAndroidJni.so] Error 1

0

There are 0 answers