Issue
Updated in project:
Gstreamer 1.14.5 -> Gstreamer 1.18.0
NDKr16 -> NDKr21.3.6528147
build:gradle:3.5.3 -> build:gradle:4.1.0
buildToolsVersion 29.0.3
compileSdk: 29, minSdk : 26, targetSdk : 29, material : "1.2.1", constraint: "2.0.2", ktx : "1.1.0", espresso : "3.1.0", mockito : "2.9.0", junit : "4.13.1"
This updates produce an issue:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.kbnt.naparnik.client.MainActivity.<clinit>(MainActivity.java:103)
at java.lang.Class.newInstance(Native Method)
...
Project building correctly but when I run app it crash with issue
Android.mk file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := client
LOCAL_SRC_FILES := client.c
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
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))
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/armv7
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_CODECS) \
$(GSTREAMER_PLUGINS_EFFECTS) \
$(GSTREAMER_PLUGINS_NET) \
$(GSTREAMER_PLUGINS_CAPTURE) \
$(GSTREAMER_PLUGINS_PLAYBACK) \
$(GSTREAMER_PLUGINS_SYS)
GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
Application.mk file:
APP_STL := c++_shared
APP_PLATFORM := android-26
I find note in documentation https://developer.android.com/ndk/guides/cpp-support#c_runtime_libraries:
libc++ is not a system library. If you use libc++_shared.so, it must be included in your APK. If you're building your application with Gradle this is handled automatically.
I understand that it building incorrectly, because my APK don`t include library
How to include libc++_shared.so into my APK programmatically with gradle?
Structure of project
app/build.gradle:
android {
compileSdkVersion versions.compileSdk
defaultConfig {
...
externalNativeBuild {
ndkBuild {
if (System.getenv("GSTREAMER_ROOT_ANDROID") == null)
throw new GradleException("Define GSTREAMER_ROOT_ANDROID environment variable")
targets "client"
abiFilters "armeabi-v7a", 'arm64-v8a'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
ndkVersion '21.3.6528147'
buildToolsVersion '29.0.3'
...
Solution
I refactored my Android.mk GSTREAMER_PLUGINS
field and add GSTREAMER_EXTRA_LIBS
. I replaced categories with specific plugins that using in my project and it solve my problem.
...
GSTREAMER_PLUGINS := coreelements udp rtpmanager rtp opengl playback
GSTREAMER_EXTRA_LIBS := -liconv
...
Looks like some plugins in categories have a bugs
Thank you @NikolayKhilyuk for trying to help me
Answered By - Almaz_KhR
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.