【问题标题】:In Android Studio 3.0.1 having trouble when trying to find files in git submodule在 Android Studio 3.0.1 中尝试在 git 子模块中查找文件时遇到问题
【发布时间】: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


    【解决方案1】:

    我找到了答案。在我将 git 子模块添加到我的项目中时,一切都结束了。有人告诉我我的 Android.mk 文件也应该在子模块中,所以我把它移到了那里,但这不是解决我的问题的方法。移动文件后,我遇到了另一个问题,它告诉我没有规则可以制作我的“native-lib.cpp”。这个问题我花了一段时间才解决。在路径中 myProject/app/build/intermediates/jniLibs/debug/ 当它不是 git 子模块时,有一个旧的文件夹副本。因此,每次我尝试构建我的 gradle 时,它​​都会告诉我没有规则会出错。我希望这最终能帮助别人。

    【讨论】:

      猜你喜欢
      • 2014-11-23
      • 1970-01-01
      • 2020-12-16
      • 2017-04-28
      • 2022-01-24
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多