我完全按照installDevelopmentEnvironment所说的步骤进行操作。
在“repo sync”之后,我在 android/OsmAnd 目录下运行脚本 ndk-build.sh。我在我的 PATH 环境变量中添加了 ANDROID_SDK、ANDROID_NDK、JAVA_HOME。我的操作系统是 Centos 6。我的 ndk 的版本是 r8。
脚本完成后,我检查了共享库文件。关于 QT 的库文件是正确构建的,例如 libQt5Core.so ,而有关 Osmand 的库文件,例如 libOsmAndCore.so ,没有构建。
我检查了输出日志,最后它说:
Android NDK:警告:模块 OsmAndCore
Android NDK 的 jni/../../../core/Android.mk 中不支持的源文件扩展名:./src/Location.cpp_ ./src/OsmAndApplication.cpp_ ./src/ PlatformAPI.cpp_
Android NDK:警告:在 jni/../../../core/Android.mk 模块 OsmAndCore
Android NDK 中不支持的源文件扩展名:./src/Location.cpp_./src/OsmAndApplication.cpp_。 /src/PlatformAPI.cpp_
Android NDK:警告:在 jni/../../../core/Android.mk 中,模块 OsmAndCore_neon
Android NDK 的源文件扩展名不受支持:./src/Location.cpp_ ./src/OsmAndApplication .cpp_ ./src/PlatformAPI.cpp_
Android NDK:警告:模块 OsmAndCore 的 jni/../../../core/Android.mk 中不支持的源文件扩展名
Android NDK:./src/Location.cpp_ ./src/OsmAndApplication.cpp_ ./src/PlatformAPI.cpp_
Android NDK:警告:jni/../../../core/Android.mk 中不支持的源文件扩展名对于模块 OsmAndCore
Android NDK: ./src/Location.cpp_ ./src/OsmAndApplication.cpp_ ./src/PlatformAPI.cpp_
make: *** No rule to make targetjni/../../../core/externals/protobuf/./upstream.patched/src/google/protobuf/extension_set.cc', needed by
obj/local/armeabi/objs/osmand_protobuf/./upstream .patched/src/google/protobuf/extension_set.o'。停止。make: *** 等待未完成的工作.... Compile++ thumb : OsmAndCore <= java_wrap.cpp
我没有更改项目中的任何文件。我阅读了上面的 Android.mk 文件,但无法弄清楚它有什么问题。
这是Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifeq ($(OSMAND_BUILDING_NEON_LIBRARY),true)
QT := $(LOCAL_PATH)/externals/qtbase-android/upstream.patched.$(TARGET_ARCH_ABI)-neon
else
QT := $(LOCAL_PATH)/externals/qtbase-android/upstream.patched.$(TARGET_ARCH_ABI)
endif
OSMAND_PROTOBUF := $(LOCAL_PATH)/externals/protobuf/upstream.patched
OSMAND_SKIA_ROOT := $(LOCAL_PATH)/externals/skia
OSMAND_SKIA := $(LOCAL_PATH)/externals/skia/upstream.patched
OSMAND_EXPAT := $(LOCAL_PATH)/externals/expat/upstream.patched
OSMAND_CORE_RELATIVE := .
OSMAND_CORE := $(LOCAL_PATH)/$(OSMAND_CORE_RELATIVE)
LOCAL_C_INCLUDES := \
$(QT)/include \
$(QT)/include/QtCore \
$(LOCAL_PATH)/src \
$(OSMAND_PROTOBUF)/src \
$(OSMAND_SKIA_ROOT) \
$(OSMAND_SKIA) \
$(OSMAND_EXPAT)/lib \
$(OSMAND_SKIA)/include/core \
$(OSMAND_SKIA)/include/config \
$(OSMAND_SKIA)/include/effects \
$(OSMAND_SKIA)/include/images \
$(OSMAND_SKIA)/include/ports \
$(OSMAND_SKIA)/include/utils \
$(OSMAND_SKIA)/include/utils/android \
$(OSMAND_SKIA)/src/core \
$(OSMAND_CORE)/include \
$(OSMAND_CORE)/src \
$(OSMAND_CORE)/protos \
$(OSMAND_CORE)/native/include \
$(OSMAND_CORE)/native/src
LOCAL_CPP_EXTENSION := .cc .cpp
SRC_FILES := $(wildcard $(OSMAND_CORE)/src/*.c*)
LOCAL_SRC_FILES := \
$(SRC_FILES:$(LOCAL_PATH)/%=%) \
$(OSMAND_CORE_RELATIVE)/native/src/ElapsedTimer.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/common.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/mapObjects.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/multipolygons.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/renderRules.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/rendering.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/binaryRead.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/binaryRoutePlanner.cpp \
$(OSMAND_CORE_RELATIVE)/native/src/proto/osmand_index.pb.cc \
$(OSMAND_CORE_RELATIVE)/native/src/java_wrap.cpp
ifdef OSMAND_PROFILE_NATIVE_OPERATIONS
LOCAL_CFLAGS += \
-DOSMAND_NATIVE_PROFILING
endif
# Name of the local module
ifneq ($(OSMAND_BUILDING_NEON_LIBRARY),true)
LOCAL_MODULE := OsmAndCore
else
LOCAL_MODULE := OsmAndCore_neon
LOCAL_ARM_NEON := true
endif
LOCAL_CFLAGS := \
-DGOOGLE_PROTOBUF_NO_RTTI \
-DSK_BUILD_FOR_ANDROID \
-DSK_BUILD_FOR_ANDROID_NDK \
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
-DSK_RELEASE \
-DSK_CPU_LENDIAN \
-DGR_RELEASE=1 \
-DANDROID_BUILD \
-fPIC
ifeq ($(LOCAL_ARM_NEON),true)
OSMAND_BINARY_SUFFIX := _neon
else
OSMAND_BINARY_SUFFIX :=
endif
LOCAL_STATIC_LIBRARIES := \
osmand_protobuf$(OSMAND_BINARY_SUFFIX) \
osmand_jpeg$(OSMAND_BINARY_SUFFIX) \
osmand_ft2$(OSMAND_BINARY_SUFFIX) \
osmand_png$(OSMAND_BINARY_SUFFIX) \
osmand_gif$(OSMAND_BINARY_SUFFIX) \
osmand_expat$(OSMAND_BINARY_SUFFIX)
LOCAL_WHOLE_STATIC_LIBRARIES := osmand_skia$(OSMAND_BINARY_SUFFIX)
LOCAL_SHARED_LIBRARIES := \
Qt5Core$(OSMAND_BINARY_SUFFIX)
LOCAL_LDLIBS := -lz -llog -ldl
include $(BUILD_SHARED_LIBRARY)
有谁知道出了什么问题?