在Android Studio 3.0.1中尝试在git子模块中查找文件时遇到问题

问题描述 投票:0回答:1

我是整个git子模块的新手,但到目前为止,我可以告诉我已经为这个等式的git方面正确地完成了这个过程。我只有几个C ++文件在git子模块中用作Android库。我之前在子模块中放置的文件夹只放在我的jni文件夹中,我的所有导入都在那里工作。

我的文件结构如下所示:

enter image description here

(还有一个级别。在jniLib中还有armeabi-v7a然后在那里有osm和google文件夹。这是我用过的旧图片,抱歉。它也是这样工作的。)

现在结构是这样的:

enter image description here

我相应地更改了我的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)

现在这里是真正的问题:

enter image description here

我知道我可以进入并修复路径它会起作用,但我有很多文件我不得不改变。在子模块之前它工作,之后没有。我试过四处寻找,但没有人真正有这个特殊的问题。我发现的东西往往是两个独立的Android Studio项目,它们用作子模块。

我在用什么:

  • Windows 10 64位
  • Android Studio 3.0.1

任何帮助都会深深体会到它。我确信有一种方法可以告诉Android工作室查看子模块,但我只是不确定如何。如果您需要我的任何其他信息,请询问。

编辑:对不起,我的意思是澄清一点。该计划搞砸的路线是:

  #include "google/include/protobuf/stubs/common.h"

我可以稍微改变一下来解决它:

 #include "../google/include/protobuf/stubs/common.h"

但随后打开了洪水门,更多地包含了我需要解决的错误。之前它没有这个问题。

android git android-studio c++11 git-submodules
1个回答
0
投票

我找到了答案。在我将git子模块添加到项目中的过程中,一切都是正确的。有人告诉我,我的Android.mk文件也应该在子模块中,所以我把它移到了那里,但这不是解决我的问题。一旦我移动了文件,我遇到了一个不同的问题,它告诉我没有规则来制作我的'native-lib.cpp'。这个问题需要我一段时间来解决。在路径myProject / app / build / intermediates / jniLibs / debug /中,当它不是git子模块时,有一个旧的文件夹副本。因为每次我都会尝试建立我的gradle,它会让我没有规则犯错误。我希望这最终会帮助其他人。

© www.soinside.com 2019 - 2024. All rights reserved.