gpt4 book ai didi

java - android.view.InflateException : Binary XML file line #0: Binary XML file line #0: Error inflating class

转载 作者:行者123 更新时间:2023-12-05 00:21:20 29 4
gpt4 key购买 nike

我刚刚使用了来自 Github 的音乐可视化器 com.chibde.audiovisulaizer.visualizer.LineBarVisualizer,在我运行应用程序时添加了它的依赖项后,它会因这条消息而崩溃。

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

这是我的错误
    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 最终确定但未发布
应用程序终止。

这是我的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>

这是我收到错误的java代码
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

}

最佳答案

XML 文件中可视化工具的类路径错误。

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

关于java - android.view.InflateException : Binary XML file line #0: Binary XML file line #0: Error inflating class <Classname>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50141428/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com