mardi 2 janvier 2018

Android Studio 3.0.1 having trouble finding files in git submodule

I'm new to the whole git submodule thing, but as far I can tell I've done the process correctly for the git side of this equation. I only have a few C++ files that are in a git submodule to be used as an Android library. I previously had the folders that are currently in the submodule just placed in my jni folder and all my imports worked there.

The structure of my files looked like this:

enter image description here

(There was one more level. in jniLib there was also armeabi-v7a then in there was the osm and google folders. It was an older pic I had, sorry. It worked that way as well.)

Now the structure is like this:

enter image description here

I've changed my Android.mk file accordingly. This is it here:

  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)

Now here is the real problem here:

enter image description here

I know I can go in and fix the path and it will work, but I have a lot of files I would have to change. Before the submodule it worked and after it doesn't. I've tried searching around, but no one really has this particular problem. The things I found tend to be two separate Android Studio Projects that they use as submodules.

What I'm using:

  • Windows 10 64-bit
  • Android Studio 3.0.1

Any help would be deeply appreciate it. I'm sure there is a way to tell Android studio to look in the submodule but I'm just not sure how. If you need anything else from me just ask.

Aucun commentaire:

Enregistrer un commentaire