gpt4 book ai didi

android-studio - Android Studio错误: Executing external native build for ndkBuild when trying to run Gstreamer tutorial

转载 作者:行者123 更新时间:2023-12-03 17:50:40 35 4
gpt4 key购买 nike

我试图在Android Sudio 3.5(https://gitlab.freedesktop.org/gstreamer/gst-docs/tree/master/examples/tutorials/android)(https://gitlab.com/eduardoprado/gstreamer-tutorial5)中运行gstreamer android tutorial-5,但出现以下错误:

ERROR: Cause: executing external native build for ndkBuild C:\Users\Downloads\gst_docs_master_examples_tutorials_android\examples\tutorials\android\android-tutorial-1\jni\Android.mk. 

我一直在关注gstreamer网站上的gstreamer android教程以及stackoverflow线程 Gstreamer examples in Android Studio

第一个目标是让gstreamer在android studio上运行。

有些线程的错误与路径目录中的空格有关,但我已经检查过,所有文件夹都没有空格。以下是一些我一直在使用并进行调整以使本教程可以运行的文件。

我还将Windows环境变量GSTREAMER_ROOT_ANDROID设置为解压缩的gstreamer二进制文件,并在android.mk文件中进行了设置。

local.properties文件
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Sep 09 08:16:12 EDT 2019
sdk.dir=C\:\\Users\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\AppData\\Local\\Android\\Sdk\\ndk\\20.0.5594570


Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

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

GSTREAMER_ROOT_ANDROID := C\:\\gstreamer_android_binaries

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 := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_PLAYBACK) $(GSTREAMER_PLUGINS_CODECS) $(GSTREAMER_PLUGINS_NET) $(GSTREAMER_PLUGINS_SYS)
G_IO_MODULES := gnutls
GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk


build.gradle(应用程序)
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "26.0.3"

defaultConfig {
applicationId "com.gst_sdk_tutorials.tutorial_5"
minSdkVersion 14
targetSdkVersion 29

externalNativeBuild {
ndkBuild {
arguments "V=1"
}
}

ndk {
moduleName "tutorial-5"
abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}

build.gradle(项目)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

allprojects {
repositories {
jcenter()
}
}

gradle-wrapper.properties
#Mon Sep 09 14:10:17 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

更新
将参数“V = 1”添加到ndkBuild部分,并收到相同的错误:
ERROR: Cause: executing external native build for ndkBuild C:\Users\Downloads\gstreamer-tutorial5-master\app\src\main\jni\Android.mk

最佳答案

  • 下载整个gstreamer android studio教程目录(https://gitlab.freedesktop.org/gstreamer/gst-docs/)

  • 2)打开Android Studio->打开现有的Android Studio项目
  • 打开整个android教程目录examples/tutorials/android作为项目

  • 4)项目打开后,将屏幕左侧的 View 更改为 Project
  • 在local.properties文件附近单击鼠标右键->新建->文件
  • 创建一个名为gradle.properties的新文件
  • 在新的gradle.properties文件中,复制并粘贴以下代码。
  • # gstAndroidRoot can be set to point to the unpacked GStreamer android top-level directory
    # containing each architecture in subdirectories, or else set the GSTREAMER_ROOT_ANDROID
    # environment variable to that location
    gstAndroidRoot=/gstreamer_android_binaries
    注意将gstAndroidRoot变量更改为下载gstreamer二进制文件并解压缩它们的文件路径。可以从此处从Android( https://gstreamer.freedesktop.org/data/pkg/android/)下载Gstreamer
  • 现在我们需要设置NDK目录。确保下载并在SDK工具下启用了NDK。

  • 9)这将下载最新的NDK版本。但是,gstreamer当前不会使用最新的NDK进行构建。我们需要下载NDK修订版18b( https://developer.android.com/ndk/downloads/older_releases)
    如果您不使用NDK版本18,则可能会收到一个错误 Android NDK: Assertion failure: SYSROOT_LINK is not defined . Stop. Open File
  • 解压缩下载的NDK 18b目录。
  • 提取解压缩的android-ndk-r18b目录,并将其移至AppData\Local\Android\Sdk\ndk下ndk文件夹的位置
  • 您现在应该在Android\Sdk\ndk中有两个文件夹。 20.0.5594570 (or latest version)android-ndk-r18b
  • 在android studio中转到文件->项目结构
  • 在Android NDK位置下,指向NDK 18目录。示例:C:\Users\AppData\Local\Android\Sdk\ndk\android-ndk-r18b
  • 用USB调试连接手机并运行!
  • 如果您在手机上收到错误消息,指出它是针对较旧版本的android的。返回Android Studio,然后切换到屏幕左侧的Android View。在Gradle Scripts下,选择相应教程的build.gradle。更改compileSdkVersion 29minSDKVersion 15targetSDKVersion 29
  • 关于android-studio - Android Studio错误: Executing external native build for ndkBuild when trying to run Gstreamer tutorial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57855409/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com