我想在我的Android手机上使用gstreamer,但是当我运行ndk-build时我遇到了这些错误,虽然我已经添加了-pthread。
任何人都知道如何解决这个问题,我在我的ubuntu计算机上构建了这个
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test_lib
LOCAL_SRC_FILES := test_gst.cpp
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog -landroid -pthread
include $(BUILD_SHARED_LIBRARY)
ifndef GSTREAMER_SDK_ROOT
ifndef GSTREAMER_SDK_ROOT_ANDROID
$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
endif
GSTREAMER_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
endif
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
错误
The list of GSTREAMER_PLUGINS is empty"
GStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c
GStreamer : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.so
gstinfo.c:1885: error: undefined reference to 'dladdr'
gwakeup.c:146: error: undefined reference to 'eventfd'
glib-unix.c:98: error: undefined reference to 'pipe2'
gthread-posix.c:444: error: undefined reference to 'pthread_rwlock_init'
gthread-posix.c:453: error: undefined reference to 'pthread_rwlock_destroy'
gthread-posix.c:652: error: undefined reference to 'pthread_condattr_init'
gthread-posix.c:669: error: undefined reference to 'pthread_condattr_destroy'
gthread-posix.c:453: error: undefined reference to 'pthread_rwlock_destroy'
gthread-posix.c:543: error: undefined reference to 'pthread_rwlock_wrlock'
gthread-posix.c:561: error: undefined reference to 'pthread_rwlock_trywrlock'
gthread-posix.c:581: error: undefined reference to 'pthread_rwlock_unlock'
gthread-posix.c:600: error: undefined reference to 'pthread_rwlock_rdlock'
gthread-posix.c:618: error: undefined reference to 'pthread_rwlock_tryrdlock'
gthread-posix.c:638: error: undefined reference to 'pthread_rwlock_unlock'
./bindtextdom.c:312: error: undefined reference to 'pthread_rwlock_unlock'
./bindtextdom.c:91: error: undefined reference to 'pthread_rwlock_wrlock'
./bindtextdom.c:91: error: undefined reference to 'pthread_rwlock_wrlock'
./loadmsgcat.c:1287: error: undefined reference to 'pthread_rwlock_init'
./textdomain.c:73: error: undefined reference to 'pthread_rwlock_wrlock'
./textdomain.c:117: error: undefined reference to 'pthread_rwlock_unlock'
./dcigettext.c:1016: error: undefined reference to 'pthread_rwlock_rdlock'
./dcigettext.c:530: error: undefined reference to 'pthread_rwlock_rdlock'
./finddomain.c:87: error: undefined reference to 'pthread_rwlock_rdlock'
collect2: error: ld returned 1 exit status
make: *** [buildsharedlibrary_armeabi-v7a] Error 1
解决方案:
android update project --name testing_2 --target 1 --path /home/username/AndroidStudioProjects/testing_2/app/src/main/
错误(当我在手机上运行Android应用程序时)
E/dalvikvm: dlopen("/data/app-lib/com.example.flowenol.testing_2-47/libtest_lib.so") failed: dlopen failed: could not load library "./obj/local/armeabi-v7a/libgstreamer_android.so" needed by "libtest_lib.so"; caused by library "./obj/local/armeabi-v7a/libgstreamer_android.so" not found
FATAL EXCEPTION: main
E/AndroidRuntime: Process: com.example.flowenol.testing_2, PID: 21833
E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "./obj/local/armeabi-v7a/libgstreamer_android.so" needed by "libtest_lib.so"; caused by library "./obj/local/armeabi-v7a/libgstreamer_android.so" not found
但我看到libgstreamer_android.so在该文件夹中 比我在加载libtest_lib之前尝试使用System.loadlibrary(“gstreamer_android”)
比我得到这些:
FATAL EXCEPTION: main
E/AndroidRuntime: Process: com.example.flowenol.testing_2, PID: 20447
E/AndroidRuntime: java.lang.NoClassDefFoundError:org/freedesktop/gstreamer/GStreamer