Soru & Cevap

Vitamio Projesi Hata

11.09.2015 - 09:30

MainActivity.java 

package com.rcpkaraav.player2;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import io.vov.vitamio.LibsChecker;
import io.vov.vitamio.MediaPlayer;
import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";
    private String path;
    //private HashMap<String, String> options;
    private VideoView mVideoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!LibsChecker.checkVitamioLibs(this))
            return;
        setContentView(R.layout.activity_main);
        mVideoView = (VideoView) findViewById(R.id.vitamio_videoView);
        path = "http://live-ciner.mncdn.net/showtv/showtv2/radyodelisi.m3u8 ";
        /*options = new HashMap<>();
        options.put("rtmp_playpath", "");
        options.put("rtmp_swfurl", "");
        options.put("rtmp_live", "1");
        options.put("rtmp_pageurl", "");*/
        mVideoView.setVideoPath(path);
        //mVideoView.setVideoURI(Uri.parse(path), options);
        mVideoView.setMediaController(new MediaController(this));
        mVideoView.requestFocus();

        mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                mediaPlayer.setPlaybackSpeed(1.0f);
            }
        });
    }
}

Activity_Main.xml 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <io.vov.vitamio.widget.VideoView
        android:id="@+id/vitamio_videoView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rcpkaraav.player2" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="io.vov.vitamio.activity.InitActivity"
            android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.NoTitleBar"
            android:windowSoftInputMode="stateAlwaysHidden" />

    </application>

</manifest>

Hata Mesajı! 

09-11 06:25:17.983  32314-32314/com.rcpkaraav.player2 E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.UnsatisfiedLinkError: Native method not found: io.vov.vitamio.MediaPlayer.native_init:()V
            at io.vov.vitamio.MediaPlayer.native_init(Native Method)
            at io.vov.vitamio.MediaPlayer.<init>(MediaPlayer.java:238)
            at io.vov.vitamio.widget.VideoView.openVideo(VideoView.java:403)
            at io.vov.vitamio.widget.VideoView.access$1400(VideoView.java:67)
            at io.vov.vitamio.widget.VideoView$3.surfaceCreated(VideoView.java:154)
            at android.view.SurfaceView.updateWindow(SurfaceView.java:543)
            at android.view.SurfaceView.access$000(SurfaceView.java:81)
            at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
            at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:671)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1818)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
            at android.view.Choreographer.doCallbacks(Choreographer.java:555)
            at android.view.Choreographer.doFrame(Choreographer.java:525)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)

Arkadaşlar Yukardaki Proje Açılmıyor program Kendini Kapatıyor nerede bi hata olmuş olabilir vitamio üzerinden herhangi bir düzenleme yapıyormuyuz acaba 

16 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-1372-1408467635.jpg
ahmtbrk
11.09.2015 - 11:24

Hatayı arattığımda şöyle bir şeye rastladım.

"The root cause is: while invoking a native method, the library is supposed to loaded-already (through System.loadLibrary()).

So my best guess is MediaPlayer.native_init is invoked before it's actually loaded while doing a first time through.

Solution: checkout where it loads the .so library and make the The MediaPlayer is initiated after the loading."

Kabaca şunu söylemek istiyor. Senin altta erişmek istediğin MediaPlayer aslında C++ ile yazılıp androide NDK ile dahil edilmiş.

System.loadLibrary ile uygulamaya o NDK ile yazılan .so uzantılı library dahil ediliyor. Fakat sen daha dahil edilme tamamen bitmeden bu MediaPlayer'i call ediyorsun ve o hatayı alıyorsun.

Solution kısmında çözüm olarak .so librarylerinin load olup olmadığını check etmeni istiyorlar MediaPlayer'i kullanmadan önce.

Fakat kodsal bir çözüm sunulmamış hatayı birazcık aratırsan ulaşacaksın.

 

 

Recep Kara
11.09.2015 - 12:34
Hocam benimde karşıma böyle sonuç cıktı ama hiç bişey anlamadım acıkcası