添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have built this app on android studio on windows 10 PC. Build is successful but when I install and open the app on Mobile with Android 9 arm64-v8a the app throws error as below,

java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1669)
at org.freedesktop.gstreamer.rtsp_example.RTSPExample.(RTSPExample.java:122)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.support.v4.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
at android.app.Instrumentation.newActivity(Instrumentation.java:1216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

I have seen at docs https://developer.android.com/ndk/guides/cpp-support to provide libstdc++_shared.so to be provided explicitly,
but I could not find any simple example of doing it

I tried adding in Application.mk as below to try,
APP_STL := c++_shared

APP_STL := c++_static

But issue still happens.

I could see there is no libstdc++_shared.so added to generated apk at path
..android_rtsp_example\app\build\outputs\apk\debug\app-debug.apk\lib\arm64-v8a\

Is this due to same reason that libstd+++shared.so is missing in apk if so how to enable Application.mk/Andoid.mk to have it added to apk?

Or Please let know if there is a different approach to address this issue?

Thanks @MathieuDuponchelle I tried to keep the same configuration as mentioned in https://gitlab.freedesktop.org/gstreamer/gst-docs/commit/5441a572d99375fb1a74d84dd3d619a8518d484f but seems its not helping. Somehow the libc++_shared.so is not packaged into .apk file.

Going through gstreamer-android unpacked tar as to my understanding it has to be loaded from path

..\arm64\share\gst-android\ndk-build\gstreamer-1.0.mk

from variable as below,

Create the link command

GSTREAMER_ANDROID_CMD := $(call libtool-link,$ (TARGET_CXX) $(GLOBAL_LDFLAGS) $ (TARGET_LDFLAGS) -nostdlib++ -shared $(SYSROOT_GST_LINK_ARG)
-o $(GSTREAMER_ANDROID_SO) $ (GSTREAMER_ANDROID_O)
-L$(GSTREAMER_ROOT)/lib -L$(GSTREAMER_STATIC_PLUGINS_PATH) -L$(CXX_SHARED_ROOT)
$(GSTREAMER_ANDROID_LIBS), $ (GSTREAMER_LD)) -Wl,-no-undefined $(GSTREAMER_LD)

Here the variable GSTREAMER_ANDROID_CMD is resolved to empty when I logged it during the build. It looks to be loading the path for missing libc++_shared.so from path

C:\Users${USER}\AppData\Local\Android\Sdk\ndk\sources\cxx-stl\llvm-libc++\libs\arm64-v8a

But somehow this variable GSTREAMER_ANDROID_CMD := $(call libtool-link... is not resolved and stays empty on build. Is there any lib/tool additionally to be installed to resolve this call libtool-link on Windows 10 machine... ?

Thanks @ystreet

Yes got it now. Adding dummy.cpp in jni folder actually made the build to include c++ library in apk.

I actually missed it assuming just an empty file.

_ Not quite fully sure how adding this .cpp file enabled build to include libc++ shared.so in apk .

Any pointers of how this is configured will be helpful for more understanding

Now I can install and open app on my android mobile. But when clicking on play button it throws message as

Error received from element source: Could not open resource for reading and writing

and no video is played. Is it that this android app needs to be allowed for network access?

@sampleref I don't quite know what to say here, can you build the tutorials on windows?

Yes I can build this tutorial on windows. I think as updated, missing dummy.cpp was issue. Once adding it apk is packaged with libc++shared.so

Thanks

Yes I can build this tutorial on windows. I think as updated, missing dummy.cpp was issue. Once adding it apk is packaged with libc++shared.so

OK, can you propose a PR?

and no video is played. Is it that this android app needs to be allowed for network access?

afaict this is simply caused by the hardcoded RTSP stream being currently unavailable ( rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov ), you can simply update https://github.com/centricular/android_rtsp_example/blob/master/app/jni/rtsp-example.c#L159 to your liking, or even better make it configurable from the interface (PR welcome as well :) )