android.view.InflateException: fichier XML binaire ligne # 9: ligne fichier XML binaire # 9: Classe d'erreur gonflage

Seyinator:

Je cherchais partout, mais je ne pouvais pas trouver une solution pour cette erreur.

J'utilise ExoPlayer pour le streaming vidéo en direct. Et mon application se bloque à chaque fois que je le lance. Si vous pouvez me aider je serai heureux.

Je suppose que ce doit être quelque part dans le fichier XML, mais je ne peux pas comprendre ce que signifie tout ce que l'erreur. XML:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<com.devbrackets.android.exomedia.ui.widget.VideoView
    android:id="@+id/video_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:useDefaultControls="true"/>

</androidx.constraintlayout.widget.ConstraintLayout>

fichier MainActivity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
    progressDialog.setMessage("Please Wait");
    progressDialog.setCancelable(false);
    progressDialog.show();

    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(videoView);
    videoView.setMediaController(mediaController);

    videoView.setVideoURI(Uri.parse("Here's path"));
    videoView.start();

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            progressDialog.dismiss();
        }
    });
  }
}

Trace de la pile:

Process: rusiptv.net, PID: 25782
java.lang.RuntimeException: Unable to start activity ComponentInfo{rusiptv.net/rusiptv.net.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
 Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
    at android.view.LayoutInflater.createView(LayoutInflater.java:647)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    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 androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
    at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    at rusiptv.net.MainActivity.onCreate(MainActivity.java:42)
    at android.app.Activity.performCreate(Activity.java:7009)
    at android.app.Activity.performCreate(Activity.java:7000)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Si vous pouvez me expliquer plus en détail sur cette erreur parce que si je vais à nouveau faire face à ce problème alors je peux le réparer facilement.

Edit: Les gars merci, tout le monde! Je fixe ce problème.

Solutions:

  • VideoView videoView = findViewById(R.id.video_view);
  • Et je l'ai changé chemin pour VideoView selon mon packageName.
S.Ambika:

S'il vous plaît vérifier si

<com.devbrackets.android.exomedia.ui.widget.VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:useDefaultControls="true"/>

chemin pour VideoView est correct selon votre packageName.

Je suppose que tu aimes

Origine http://43.154.161.224:23101/article/api/json?id=292479&siteId=1
conseillé
Classement