【发布时间】:2018-01-02 17:14:12
【问题描述】:
我是整个 git 子模块的新手,但据我所知,我已经为这个等式的 git 侧正确地完成了这个过程。我只有几个位于 git 子模块中的 C++ 文件可用作 Android 库。我以前将当前位于子模块中的文件夹放在我的 jni 文件夹中,并且我的所有导入都在那里工作。
我的文件结构如下所示:
(还有一个级别。在 jniLib 中还有 armeabi-v7a,然后是 osm 和 google 文件夹。我有一张较旧的图片,抱歉。它也是这样工作的。)
现在的结构是这样的:
我已经相应地更改了我的 Android.mk 文件。 就是这里:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf-lite
LOCAL_SRC_FILES := nearby_osm_lib/osm/libprotobuf-lite.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := native-lib
LOCAL_SHARED_LIBRARIES := libprotobuf-lite
LOCAL_CPP_EXTENSION := .cxx .cpp .cc
LOCAL_LDFLAGS := -lz -llog
LOCAL_CPP_FEATURES := rtti
LOCAL_SRC_FILES := \
nearby_osm_lib/osm/native-lib.cpp \
nearby_osm_lib/google/include/protobuf/io/coded_stream.cc \
nearby_osm_lib/google/include/protobuf/wire_format_lite.cc \
nearby_osm_lib/google/include/protobuf/arenastring.cc \
nearby_osm_lib/google/include/protobuf/arena.cc \
nearby_osm_lib/google/include/protobuf/stubs/int128.cc \
nearby_osm_lib/google/include/protobuf/message_lite.cc \
nearby_osm_lib/google/include/protobuf/io/zero_copy_stream_impl_lite.cc \
nearby_osm_lib/google/include/protobuf/io/zero_copy_stream.cc \
nearby_osm_lib/google/include/protobuf/generated_message_util.cc \
nearby_osm_lib/google/include/protobuf/stubs/common.cc \
nearby_osm_lib/osm/BeaconSearchResult.cpp \
nearby_osm_lib/osm/Geopoint.cpp \
nearby_osm_lib/osm/fileformat.pb.cc \
nearby_osm_lib/osm/osmformat.pb.cc \
nearby_osm_lib/osm/Location.cpp \
nearby_osm_lib/osm/osmpbf.cpp \
nearby_osm_lib/osm/OSMPBFread.cpp \
nearby_osm_lib/osm/OSMPOISearch.cpp \
nearby_osm_lib/osm/POI.cpp \
LOCAL_CFLAGS := -std=c++11
include $(BUILD_SHARED_LIBRARY)
现在真正的问题在这里:
我知道我可以进入并修复路径,它会起作用,但我有很多文件需要更改。在子模块之前它起作用,之后它不起作用。我试过四处寻找,但没有人真正遇到这个特殊问题。我发现的东西往往是两个独立的 Android Studio 项目,它们用作子模块。
我正在使用什么:
- Windows 10 64 位
- Android Studio 3.0.1
任何帮助将不胜感激。我确信有一种方法可以告诉 Android Studio 查看子模块,但我只是不确定如何。如果您需要我的其他任何东西,请询问。
编辑:对不起,我的意思是澄清一点。程序搞砸的那一行是:
#include "google/include/protobuf/stubs/common.h"
我可以稍微修改一下:
#include "../google/include/protobuf/stubs/common.h"
但这打开了闸门,更多包含我需要修复的错误。之前没有这个问题。
【问题讨论】:
标签: android git android-studio c++11 git-submodules