Android Studio (editor) cannot see Gst header files

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Android Studio (editor) cannot see Gst header files

jeremi.wojcicki
High Guys,

I'm beginning my adventure with Gstreamer framework for Android. I decided to use Android Studio rather that eclipse as it seems that it is probably a better choice for the future (AS is now the official IDE). Anywa,y I successfully managed to import, configure and build GST tutorials for android but one thing that still baffles me is that AS editor does not see GST header files:

I do not know how to solve it - i tried adding the path to the header in gradle.bulild file, but that does not bring any effect:

        ndk {
            moduleName "tutorial-4"
            abiFilters 'arm64-v8a'
            cFlags += "-I${file("F:/GST-android/arm64/include/gstreamer-1.0/")}".toString()
        }

Compilation runs fine, so GSTREAMER_ROOT_ANDROID is set correctly, it just that Android Studio editor complains that it cannot resolve any gstreamer structs or functions.

any ideas how to point AS to these headers?
Reply | Threaded
Open this post in threaded view
|

Re: Android Studio (editor) cannot see Gst header files

jeremi.wojcicki
In the end I solved the problem myself. So if sb would have similar issue in the future I post my solution.

It was needed to modify the makefile (Android.mk) and add locations of missed libs into LOCAL_C_INCLUDES before include $(BUILD_SHARED_LIBRARY) was built. Here is my entire Android.mk:


ifndef GSTREAMER_ROOT_ANDROID
$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif

ifeq ($(TARGET_ARCH_ABI),armeabi)
GSTREAMER_ROOT        := $(GSTREAMER_ROOT_ANDROID)/arm
else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
GSTREAMER_ROOT        := $(GSTREAMER_ROOT_ANDROID)/armv7
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
GSTREAMER_ROOT        := $(GSTREAMER_ROOT_ANDROID)/arm64
else ifeq ($(TARGET_ARCH_ABI),x86)
GSTREAMER_ROOT        := $(GSTREAMER_ROOT_ANDROID)/x86
else ifeq ($(TARGET_ARCH_ABI),x86_64)
GSTREAMER_ROOT        := $(GSTREAMER_ROOT_ANDROID)/x86_64
else
$(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
endif

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := tutorial-3
LOCAL_SRC_FILES := tutorial-3.c
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog -landroid

# my addition to fix Android Studio complaints about dependencies

LOCAL_C_INCLUDES := $(GSTREAMER_ROOT)/include
LOCAL_C_INCLUDES += $(GSTREAMER_ROOT)/include/gstreamer-1.0
LOCAL_C_INCLUDES += $(GSTREAMER_ROOT)/include/glib-2.0
LOCAL_C_INCLUDES += $(GSTREAMER_ROOT)/lib/glib-2.0/include

include $(BUILD_SHARED_LIBRARY)

GSTREAMER_NDK_BUILD_PATH  := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS         := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_SYS) $(GSTREAMER_PLUGINS_EFFECTS)
GSTREAMER_EXTRA_DEPS      := gstreamer-video-1.0
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk