2

I just used a music visualiser com.chibde.audiovisulaizer.visualizer.LineBarVisualizer from Github, after adding its dependency when I run the app it crashes with this message.

 android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.chibde.audiovisulaizer.visualizer.LineBarVisualizer

Here is my error

    E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.au.zeephremia.sunoopk, PID: 25718
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.au.zeephremia.sunoopk/com.au.zeephremia.sunoopk.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.chibde.audiovisulaizer.visualizer.LineBarVisualizer
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
                  at android.app.ActivityThread.-wrap11(ActivityThread.java)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
                  at android.os.Handler.dispatchMessage(Handler.java:111)
                  at android.os.Looper.loop(Looper.java:207)
                  at android.app.ActivityThread.main(ActivityThread.java:5728)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
               Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.chibde.audiovisulaizer.visualizer.LineBarVisualizer
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:426)
                  at android.app.Activity.setContentView(Activity.java:2191)
                  at com.au.zeephremia.sunoopk.MainActivity.onCreate(MainActivity.java:56)
                  at android.app.Activity.performCreate(Activity.java:6309)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5728) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
               Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.chibde.audiovisulaizer.visualizer.LineBarVisualizer
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                  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.inflate(LayoutInflater.java:515)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:426) 
                  at android.app.Activity.setContentView(Activity.java:2191) 
                  at com.au.zeephremia.sunoopk.MainActivity.onCreate(MainActivity.java:56) 
                  at android.app.Activity.performCreate(Activity.java:6309) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5728) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
               Caused by: java.lang.ClassNotFoundException: Didn't find class "com.chibde.audiovisulaizer.visualizer.LineBarVisualizer" on path: DexPathList[[zip file "/data/app/com.au.zeephremia.sunoopk-2/base.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.au.zeephremia.sunoopk-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.au.zeephremia.sunoopk-2/lib/arm64, /vendor/lib64, /system/lib64]]
                  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                  at android.view.LayoutInflater.createView(LayoutInflater.java:583)
                  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.inflate(LayoutInflater.java:515) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:426) 
                  at android.app.Activity.setContentView(Activity.java:2191) 
                  at com.au.zeephremia.sunoopk.MainActivity.onCreate(MainActivity.java:56) 
                  at android.app.Activity.performCreate(Activity.java:6309) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
                  at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
                  at android.os.Handler.dispatchMessage(Handler.java:111) 
                  at android.os.Looper.loop(Looper.java:207) 
                  at android.app.ActivityThread.main(ActivityThread.java:5728) 
                  at java.lang.reflect.Method.invoke(Native Method) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
                Suppressed: java.lang.ClassNotFoundException: com.chibde.audiovisulaizer.visualizer.LineBarVisualizer
                  at java.lang.Class.classForName(Native Method)
                  at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                    at java.

W/MediaPlayer-JNI: MediaPlayer finalized without being released Application terminated.

This is my xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
tools:context="com.au.zeephremia.sunoopk.MainActivity">


<com.chibde.audiovisulaizer.visualizer.LineBarVisualizer
    android:id="@+id/visualizer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="150dp"
    android:gravity="center"
    android:elevation="0dp"
    android:id="@+id/ablMAIN">
<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="SUNOO.PK!"
        android:textSize="50sp"
        android:fontFamily="cursive"/>


</android.support.design.widget.AppBarLayout>

This is my java code where I am getting the error

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    Error <--setContentView(R.layout.activity_home);

    LineBarVisualizer lineBarVisualizer = findViewById(R.id.visualizer);
    lineBarVisualizer.setColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    lineBarVisualizer.setPlayer(son.getAudioSessionId());
    // REMAINING CODE

}

1
  • The problem is in class com.chibde.audiovisulaizer.visualizer.LineBarVisualizer in xml file. Suppose, it needs some additional necessary tags. So, read the primary documentation with the use cases. Try to use the exact dp for height, like 250dp, but not the wrap_content. Commented May 2, 2018 at 20:50

1 Answer 1

4

Classpath for visualizer in the XML file is wrong.

<com.chibde.visualizer.LineBarVisualizer
android:id="@+id/visualizer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.