bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.59k stars 8.14k forks source link

the android 6.0 can't load native lib #709

Closed xiejinglan closed 8 years ago

xiejinglan commented 8 years ago

dlopen failed: /data/app/com.xsteach-2/lib/x86/libijkffmpeg.so: has text relocations java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.xsteach-2/lib/x86/libijkffmpeg.so: has text relocations at java.lang.Runtime.loadLibrary(Runtime.java:372) at java.lang.System.loadLibrary(System.java:1076) at tv.danmaku.ijk.media.player.IjkMediaPlayer$1.loadLibrary(IjkMediaPlayer.java:144) at tv.danmaku.ijk.media.player.IjkMediaPlayer.loadLibrariesOnce(IjkMediaPlayer.java:155) at com.xsteach.widget.video.XSMediaPlayer.(XSMediaPlayer.java:48) at java.lang.reflect.Constructor.newInstance(Native Method) at android.view.LayoutInflater.createView(LayoutInflater.java:619) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.xsteach.app.core.XSBaseActivity.setContentView(XSBaseActivity.java:57) at com.xsteach.app.core.XSBaseActivity.onCreate(XSBaseActivity.java:49) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

daisuke-nomura commented 8 years ago

I saw same problem on x86 emulator.

xiejinglan commented 8 years ago

@daisuke-nomura ye , on android 6.0 , it's not work, but in android 5.0,5.1 4.4 or other , it's work ok, so , i don't know what's the problem

bbcallen commented 8 years ago

This is a FFmpeg vs Android issue. Just set a lower target sdk level as a workaround, if you really need x86 support on 6.0.

bbcallen commented 8 years ago

Fixed on master. Use x86_64 instead of x86 could fix this issue.

NikmanSergey commented 8 years ago

@bbcallen, Thanks for that! x86_64 seems working fine. But how about x86_32 and armeabi-v8a ? They are also affected by this issue: "has text relocations" error with TargetSDK=23 on System.load("/data/data/app/files/libs/libijkffmpeg.so") loading from a custom place. Is it something that should be fixed in FFmpeg project? Thanks!

rooque commented 8 years ago

@NikmanSergey @bbcallen see https://github.com/Bilibili/ijkplayer/pull/953

Android4MediaPlayer commented 8 years ago

I think this approach is not appropriate.

bbcallen commented 8 years ago

https://trac.ffmpeg.org/ticket/4928

rooque commented 8 years ago

@Android4MediaPlayer Why not ?

stuckless commented 8 years ago

Just wanted to add, that, since this is at a stalemate (not that I expect IJKPlayer to fix this), but, a work around for now, would be to NOT target android version 23. ie, in my code, I set my compile and target sdks to 22 and and my build tools to version 22.x.x, and rebuilt everything, and tested it on Android M x86 and IJKPlayer works. At some point, I'll have to target v23, but until then, at least my users can use IJKPlayer. Be sure if you are targeting 22, that you update all the android support library versions to be 22.x.x as well or else you'll get errors about missing v23 resources.

bbcallen commented 8 years ago

@stuckless Did you see any real x86_32 devices shipped with Android M or above except simulators? IMO, building both x86_32 and x86_64 would be my choice, since we can't stay on API-22 forever.

stuckless commented 8 years ago

@bbcallen It appeared that the users having issues were Nexus Player users that upgraded to M. Not sure they upgraded to M manually or if it was pushed. That being said, I'll have to see if I'm actually including the x86_64 natives. Maybe my real issue is that I'm not includes x86_64 natives. thx.

chrisjenx commented 8 years ago

Now we are hitting API 25 where are we at with this?

What's the work around, just build v7a, v8a, x86_64? Really disapointed in both Android and FFMpeg on this issue.

bbcallen commented 8 years ago

disable asm for x86. or carry x86_64 with x86

Vaporexpress commented 7 years ago

Related to: http://stackoverflow.com/questions/32885533/android-6-0-preview-3-device-with-target-sdk-23-system-loadlibrary-is-fail Seems that fails for this api 23 changes: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html?hl=en#behavior-runtime And pointed that: "You'll have to fix them, which means you need to have access to the native code and NDK prepared. Easiest workaround is to add -fpic or -fPIC to your LOCAL_CFLAGS in your Android.mk file, and then rebuild the libraries." Needs verification.