0

I am trying to run the android tutorials for gstreamer from the official website. First tutorial worked fine because it doesn't use any plugins. But I couldn't make the rest of them work. At the second tutorial the problem is one of the plugins is not found : autoaudiosink.
Android Studio opens a file "/home/borlea/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/ld.gold" but it doesn't have anything intelligible in it, and I get these errors:
Error:error: cannot find -lgstautoaudiosink
Error:error: undefined reference to 'gst_plugin_autoaudiosink_register'
Error:error: linker command failed with exit code 1 (use -v to see invocation)

This is my Android.mk file

   LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE    := tutorial-2
    LOCAL_SRC_FILES := tutorial-2.c
    LOCAL_SHARED_LIBRARIES := gstreamer_android
    LOCAL_LDLIBS := -llog
    include $(BUILD_SHARED_LIBRARY)

    GSTREAMER_ROOT_ANDROID := /home/borlea/Downloads/gstreamer-1.0-android-universal-1.12.3

    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

    GSTREAMER_NDK_BUILD_PATH  := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
    include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
    GSTREAMER_PLUGINS         := audiotestsrc audioconvert audioresample autoaudiosink
    include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk

What have I done wrong ?

Print screen of the build error:

This is a print screen of the error build error I get

Thanks in advance.

1 Answers1

1

I had the same error when I was trying the tutorials and if I remember correctly the problem is the linking between Android Studio and the Android.mk. To solve it you have to:
1. Right click at “app” in the left navigation tab
2. Click at "Link C++ Project with Gradle"
3. In the new window:
- Change "Build System" from "CMake" to "ndk-build"
- Click at "..." and browse to the Android.mk’s location "/AndroidStudioProjects/android-studio-5/app/src/jni/Android.mk"
- Hit OK

Hopefully that will fix the error but another erros will appeared. The main problem with the tutorials is that it were made for eclipse. So, after some study about how the NDK, makefile.mk GStreamer and Android Studio works I ended up doing a step-by-step on how to run all these tutorials on Android Studio.
The link for the answer I gave with the steps to run is: Gstreamer examples in Android Studio
There you will find pictures (this anwser is the second step from the tutorial).

Eduardo Fernando
  • 619
  • 10
  • 17
  • thanks for the answer ! I have already seen the other answer you gave at that question . I have followed what you said there, and it solved some of the errors , but I still get the errors mentioned in the question. I also tried to run your project from GitLab but I get another error. As far as I know you are the only guy that posted a project with gstreamer in Android Studio. I'm not home right now , and I don't remember the error I got from your project. But I would be vary grateful if you can help me, maybe I can make your work on my pc ... . Thanks again @Eduardo Fernando – Andrei Daniel Borlea Oct 17 '17 at 14:18
  • 1
    I'm glad to help. Just let me know exactly the error that you got trying to run my project from git and I can try solve it to work for you too. It will be good for updating my tutorials too. @AndreiDanielBorlea – Eduardo Fernando Oct 17 '17 at 14:50
  • I managed to make your project work on my computer, it was a problem from android studio, this [tutorial](https://www.youtube.com/watch?v=1QkYd_QjEWc) helped me solve it . But still I have those errors described in my question, related to tutorial 2 and 3. The "autoaudiosink" plugin isn't found I don't know why ... – Andrei Daniel Borlea Oct 18 '17 at 16:00
  • That's true, I think that at some point of my trying to make the tutorials work I disabled "Instant run". I have to update my other tutorial adding this step. Thanks for your feedback. Regarding your error I'm planning (when I have some time) to try tutorials 2 and 3 try to remember if I done something different. If I'm able to make it work and find your error I will upload the tutorial working and give you the answer. – Eduardo Fernando Oct 20 '17 at 12:21
  • I found one error. To run tutorial 2 you have to remove 'armeabi' from step 4 from the tutorial... Probably tutorial 3 have some architecture to remove from the same step... I don't have time to upload the project now, maybe later today I do it... So, at step 4 instead of : abiFilters 'x86','armeabi', 'armeabi-v7a', 'arm64-v8a' insert: abiFilters 'x86','armeabi-v7a', 'arm64-v8a' – Eduardo Fernando Oct 20 '17 at 14:25
  • I don't have my laptop right now. But as soon as I get home I'll try what you said, and I'll tell you how it works. Thanks! @EduardoFernando – Andrei Daniel Borlea Oct 20 '17 at 14:29
  • I tried what you said but I still get those errors. I added a print screen in the question. Maybe you can figure out something from it @EduardoFernando – Andrei Daniel Borlea Oct 20 '17 at 19:24
  • I think I already had this error in the past but I don't remember exactly how I solved it. My best bet still in step 4 because I think the compiler is trying to build one architecture that misses the plugin needed but I not sure... In the Android Studio IDE there's a "Gradle Console", look for it and if you see errors there print them here for me please (here a screenshot "Gradle Console": https://imgur.com/a/2qSRv). Here the tutorial 2 working: https://gitlab.com/eduardoprado/gstreamer-tutorial2.git (remember to change some paths when asked like GSTREAMER_ROOT_ANDROID)@AndreiDanielBorlea – Eduardo Fernando Oct 22 '17 at 18:34