matthewn4444 / VPlayer_lib

Simple FFmpeg library for android for multiple architectures
Apache License 2.0
44 stars 13 forks source link

UnsatisfiedLinkError, libffmpeg-neon.so: has text relocations #3

Open vxhviet opened 8 years ago

vxhviet commented 8 years ago

Hi @matthewn4444 ,

Sorry I need a quick help on this matter. After failing to inflate your VPlayerView via the xml, I try to use the most basic method which is this one:

public class VideoActivity extends Activity {
    private VPlayerView mPlayerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Attach the player
        mPlayerView = new VPlayerView(this);
        setContentView(mPlayerView);

        // Set the content and play the video
        mPlayerView.setDataSource(path);
        mPlayerView.play();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mPlayerView.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mPlayerView.onResume();
    }

    @Override
    public void finish() {
        super.finish();
        mPlayerView.finish();
    }
}

and I get the following error:

FATAL EXCEPTION: main
Process: com.example.viet.myappdemo, PID: 20473
    java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.example.viet.myappdemo-1/lib/arm/libffmpeg-neon.so: has text relocations
        at java.lang.Runtime.loadLibrary(Runtime.java:372)
        at java.lang.System.loadLibrary(System.java:1076)
        at com.vplayer.VPlayerController.<clinit>(VPlayerController.java:194)
        at com.vplayer.VPlayerView.<init>(VPlayerView.java:55)
        at com.vplayer.VPlayerView.<init>(VPlayerView.java:49)
        at com.vplayer.VPlayerView.<init>(VPlayerView.java:45)
        at com.example.viet.myappdemo.VPlayerActivity.onCreate(VPlayerActivity.java:34)
        at android.app.Activity.performCreate(Activity.java:6251)
        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)

My testing device is a Nexus 5 running armv7.

Any help is very much appreciated.

vxhviet commented 8 years ago

Ok for any viewer that possibly having these problem. The "text relocation" still exist when I compile fresh FFmpeg v3.0.2 so the temporary solution is to change your target SDK to 22.

For the VPlayerView can't be inflated with the xml you will need to change the following in VPlayerView:

public VPlayerView(Activity activity, AttributeSet attrs) to public VPlayerView(Context context, AttributeSet attrs)

of course you will need change any relating elements.

matthewn4444 commented 8 years ago

I will look into this later, my PC just died so I need to reformat etc.

vxhviet commented 8 years ago

I've investigated on this issue before, take a look at this. Long story short, Google messes something up and FFmpeg refuse to solve it so we stuck in the middle. But it seem strange that this issue has been there for a long time, it should be fixed by now. I just don't understand why my freshly compiled version of FFmpeg 3.0.2 with NDK 11c still has it.

FFmpeg and Android just aren't meant to be together.

matthewn4444 commented 6 years ago

I am very sorry for delaying this issue. I will be fixing this in a week or two. The only solution I can find is to disable assembly :( since FFMPEG won't rewrite their code. I am super disappointed. For now build below sdk 22 (if possible) to avoid the error (though you might get a popup when using the view). I think arm 64 doesnt have this issue but I need to see later when I get on to fix this issue.