gpt4 book ai didi

AndroidX 导致 AppCompatActivity 崩溃

转载 作者:搜寻专家 更新时间:2023-11-01 08:17:59 25 4
gpt4 key购买 nike

应用程序运行良好,直到突然以某种方式触发此错误:

E/AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:543)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.thorsguild.company..Activities.MainActivity.onCreate(MainActivity.java:89)

我应该提一下,我刚刚开始使用 this library from GitHub它服务于一组切换按钮并且即将对其进行测试

问:这个错误是什么意思,如何解决??

更新

整个堆栈跟踪

2019-05-31 12:04:14.216 14753-14753/com.hablo.company.hablo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hablo.company.hablo, PID: 14753
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hablo.company.hablo/com.hablo.company.hablo.Activities.MainActivity}: android.view.InflateException: Binary XML file line #126: Binary XML file line #111: Error inflating class com.nex3z.togglebuttongroup.button.CircularButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2947)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.view.InflateException: Binary XML file line #126: Binary XML file line #111: Error inflating class com.nex3z.togglebuttongroup.button.CircularButton
Caused by: android.view.InflateException: Binary XML file line #111: Error inflating class com.nex3z.togglebuttongroup.button.CircularButton
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.nex3z.togglebuttongroup.button.CircularButton" on path: DexPathList[[zip file "/data/app/com.hablo.company.hablo-1/base.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.hablo.company.hablo-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.hablo.company.hablo-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:616)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1011)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
2019-05-31 12:04:14.216 14753-14753/com.hablo.company.hablo E/AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:543)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:136)
at com.hablo.company.hablo.Activities.MainActivity.onCreate(MainActivity.java:89)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2900)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

最佳答案

看来你看错了类名。您应该使用 CircularToggle 但您使用的是库中不存在的 CircularButton。您可以查看github上提到的示例用法,如下所示

<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="@+id/choice_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"/>

关于AndroidX 导致 AppCompatActivity 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56393868/

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