使用NDK中的退出代码获取错误链接器命令失败

时间:2017-08-30 13:28:03

标签: android c++ android-ndk ndk-build

这是我的Android.mk文件

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)

我的Application.mk看起来像

APP_ABI=armeabi armeabi-v7a

我在构建apk时遇到错误

  

错误:错误:链接器命令失败,退出代码为1(使用-v查看调用)

有时工作室抛出警告:'__ANDROID_API__'宏重新定义

这是例外

  

任务执行失败':androidHelper:externalNativeBuildDebug'。   构建命令失败。   执行进程C:\ Users \ waqas \ AppData \ Local \ Android \ Sdk \ ndk-bundle \ ndk-build.cmd时出错,参数为{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]编译++:ftrAnsiSDKAndroidJni< = ftrAnsiSDKAndroidJni.cpp   文件包括:333:   :4:9:警告:' ANDROID_API '宏重新定义[-Wmacro-redefined]

     

定义 ANDROID_API 17

    ^
     

:3:9:注意:之前的定义在这里

     

定义 ANDROID_API 1

    ^
  

生成1个警告。   [mips] SharedLibrary:libftrAnsiSDKAndroidJni.so   D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj/local/mips/libusb-1.0.so:错误添加符号:文件格式错误   clang ++。exe:错误:链接器命令失败,退出代码为1(使用-v查看调用)   make:[D:/Androidprojects/androidstudiolatestzongsourceready/POSApp_AV06_STC_BVS/androidHelper/build/intermediates/ndkBuild/debug/obj/local/mips/libftrAnsiSDKAndroidJni.so]错误1

0 个答案:

没有答案