bin / bash:i:在Android Studio

时间:2016-04-10 12:03:00

标签: video-streaming gstreamer

我正在尝试使用mac osx 10.8.5在Andriod Studio上构建Gstreamer教程示例5.

  1. 我已从https://github.com/jaroslavas/Gstreamer-Android-example

  2. 下载了教程
  3. 我已经从

  4. 下载了ndk“android-ndk-r11c”
  5. 我从https://gstreamer.freedesktop.org/data/pkg/android/1.8.0/下载了Gstreamer Android库gstreamer-1.0-android-arm-1.8.0

  6. 4.我编辑了local.properties - 设置SDK和NDK路径

    1. 我编辑了src / main / jni / Android.mk文件并将GSTREAMER_ROOT_ANDROID设置为我提取Gstreamer库的路径

    2. 我创建了一个gradle.properties文件,以便设置标志android.useDeprecatedNdk = true

    3. 我已添加:

      sourceSets.main {     jni.srcDirs = [] }

    4. Android下的

      为了不让Android Studio覆盖.mk文件

      1. 运行。
      2. Gradle控制台显示了几个

        /bin/bash: i: command not found
        make: [genstatic_armeabi] Error 127 (ignored)
        

        以下是完整的控制台日志:

        bin/bash: - : invalid option
        Usage:  /bin/bash [GNU long option] [option] ...
            /bin/bash [GNU long option] [option] script-file ...
        GNU long options:
            --debug
            --debugger
            --dump-po-strings
            --dump-strings
            --help
            --init-file
            --login
            --noediting
            --noprofile
            --norc
            --posix
            --protected
            --rcfile
            --restricted
            --verbose
            --version
            --wordexp
        Shell options:
            -irsD or -c command or -O shopt_option      (invocation only)
            -abefhkmnptuvxBCHP or -o option
        /bin/bash: - : invalid option
        Usage:  /bin/bash [GNU long option] [option] ...
            /bin/bash [GNU long option] [option] script-file ...
        GNU long options:
            --debug
            --debugger
            --dump-po-strings
            --dump-strings
            --help
            --init-file
            --login
            --noediting
            --noprofile
            --norc
            --posix
            --protected
            --rcfile
            --restricted
            --verbose
            --version
            --wordexp
        
        ......
        
        GStreamer      : [GEN] => gst-build-armeabi/gstreamer_android.c
        
        /bin/bash: i: command not found
        make: [genstatic_armeabi] Error 127 (ignored)
        /bin/bash: i: command not found
        make: [genstatic_armeabi] Error 127 (ignored)
        /bin/bash: i: command not found
        make: [genstatic_armeabi] Error 127 (ignored)
        /bin/bash: i: command not found
        make: [genstatic_armeabi] Error 127 (ignored)
        
        GStreamer      : [COMPILE] => gst-build-armeabi/gstreamer_android.c
        
        gst-build-armeabi/gstreamer_android.c:17:2: error: stray '@' in program
          @PLUGINS_DECLARATION@
          ^
        gst-build-armeabi/gstreamer_android.c:17:22: error: stray '@' in program
          @PLUGINS_DECLARATION@
                              ^
        gst-build-armeabi/gstreamer_android.c:20:2: error: stray '@' in program
          @G_IO_MODULES_DECLARE@
          ^
        gst-build-armeabi/gstreamer_android.c:17:3: error: unknown type name 'PLUGINS_DECLARATION'
          @PLUGINS_DECLARATION@
           ^
        gst-build-armeabi/gstreamer_android.c:20:23: error: stray '@' in program
          @G_IO_MODULES_DECLARE@
                               ^
        gst-build-armeabi/gstreamer_android.c:23:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
         void
         ^
        gst-build-armeabi/gstreamer_android.c:26:2: error: stray '@' in program
          @PLUGINS_REGISTRATION@
          ^
        gst-build-armeabi/gstreamer_android.c:26:23: error: stray '@' in program
          @PLUGINS_REGISTRATION@
                               ^
        gst-build-armeabi/gstreamer_android.c: In function 'gst_android_load_gio_modules':
        gst-build-armeabi/gstreamer_android.c:33:2: error: stray '@' in program
          @G_IO_MODULES_LOAD@
          ^
        gst-build-armeabi/gstreamer_android.c:33:20: error: stray '@' in program
          @G_IO_MODULES_LOAD@
                            ^
        gst-build-armeabi/gstreamer_android.c:33:3: error: 'G_IO_MODULES_LOAD' undeclared (first use in this function)
          @G_IO_MODULES_LOAD@
           ^
        gst-build-armeabi/gstreamer_android.c:33:3: note: each undeclared identifier is reported only once for each function it appears in
        gst-build-armeabi/gstreamer_android.c:34:1: error: expected ';' before '}' token
         }
         ^
        gst-build-armeabi/gstreamer_android.c: In function 'gst_android_init':
        gst-build-armeabi/gstreamer_android.c:497:3: error: implicit declaration of function 'gst_android_register_static_plugins' [-Werror=implicit-function-declaration]
           gst_android_register_static_plugins ();
           ^
        cc1: all warnings being treated as errors
        make: *** [gst-build-armeabi/gstreamer_android.o] Error 1
        
        :app:ndkBuild FAILED
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':app:ndkBuild'.
        > Process 'command '/Users/vincenzodigiovambattista/AndroidStudioProjects/android-ndk-r11c/ndk-build'' finished with non-zero exit value 2
        

        有什么建议吗?

        我知道为Android Studio构建gstreamer很痛苦,检查周围没有完整的指南用于此目的,我想用这篇文章创建一个!

2 个答案:

答案 0 :(得分:1)

首先,在已知问题的https://gstreamer.freedesktop.org/releases/1.8/下,您可以看到无法使用NDK r11进行构建。请改用NDK r10。

如果你得到同样的错误,请转到GStreamer包中的share / gst-android / ndk-build文件夹,然后查看gstreamer-1.0.mk文件。搜索genstatic _ $(TARGET_ARCH_ABI)。在那里,您将看到该命令的定义,并可以检查它是否有任何错误。

有了这个错误,bash基本上会告诉你在执行genstatic_armeabi命令时遇到了一个未知的命令“i”。

答案 1 :(得分:0)

  

HOST_SED仅在 Windows平台上定义。

     

我们需要根据需要定义HOST_SED。

<强> gstreamer-1.0.mk

# Host tools
ifeq ($(HOST_OS),windows)
    HOST_SED := $(GSTREAMER_NDK_BUILD_PATH)/tools/windows/sed
    GSTREAMER_LD :=
else
    HOST_SED := sed //linux
endif

....

@$(HOST_ECHO) "GStreamer      : [GEN] => $(PRIV_C)"
@$(call host-mkdir,$(PRIV_B_DIR))
@$(call host-cp,$(PRIV_C_IN),$(PRIV_C))
@$(HOST_SED) -i "s/@PLUGINS_DECLARATION@/$(PRIV_P_D)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@PLUGINS_REGISTRATION@/$(PRIV_P_R)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@G_IO_MODULES_LOAD@/$(PRIV_G_L)/g" $(PRIV_C)
@$(HOST_SED) -i "s/@G_IO_MODULES_DECLARE@/$(PRIV_G_R)/g" $(PRIV_C)