ndk-build错误prebuilt-library.mk:28:***缺少分隔符。停止

时间:2015-05-13 17:08:06

标签: android c android-ndk java-native-interface .a

我收到了错误

 Android NDK: ERROR:src/main/jni/Android.mk:Cortex: The LOCAL_SRC_FILES
 for a prebuilt library should only contain one item
 /Users/peterchappy/Library/Android/ndk/build/core/prebuilt-library.mk:28:
 *** missing separator.  Stop.

当我运行ndk-build时。我不确定问题是什么。任何帮助将不胜感激。

Android.mk

LOCAL_PATH := $(call my-dir)

# static library info
LOCAL_MODULE := Cortex
LOCAL_MODULE_FILENAME := CortexLibrary-i386
LOCAL_EXPORT_C_INCLUDES := ../prebuild/include
include $(PREBUILT_STATIC_LIBRARY)

# wrapper info
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += ../prebuild/include
LOCAL_MODULE    := wrapper
LOCAL_SRC_FILES := wrapper.c
LOCAL_STATIC_LIBRARIES := libYourLibrary
include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_static 
APP_PLATFORM := android-8 
APP_BUILD_SCRIPT := Android.mk

2 个答案:

答案 0 :(得分:1)

看起来你错过了:

LOCAL_SRC_FILES := yourmodule.a

之前:

include $(PREBUILT_STATIC_LIBRARY)

在prebuilt-library.mk中你可以看到:

# Check that LOCAL_SRC_FILES contains only paths to shared libraries
ifneq ($(words $(LOCAL_SRC_FILES)),1)
$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): The LOCAL_SRC_FILES for a prebuilt static library should only contain one item))
$(call __ndk_error,Aborting)
endif

或者它可能设置为某个无效值,您应该添加:

include $(CLEAR_VARS)

之后:

# static library info

答案 1 :(得分:0)

我在build.gradle中添加了ndk abiFilters,它可以工作。

defaultConfig {
    applicationId "com.coffee.test"
    minSdkVersion 21
    targetSdkVersion 22
    versionCode 1
    versionName "1.0
    ndk {
        abiFilters "armeabi-v7a"
    }
}