AndroidX вызывает сбой AppCompatActivity - PullRequest
1 голос
/ 31 мая 2019

Приложение работало очень хорошо, пока неожиданно не возникла эта ошибка:

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)

Я должен упомянуть, что я только начал использовать эту библиотеку от GitHub , которая служит для переключения групповых кнопок и собиралась протестировать ее

Q: Что означает эта ошибка и как ее исправить ??

UPDATE

Весь след стека

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)

1 Ответ

3 голосов
/ 31 мая 2019

Похоже, вы неправильно прочитали имя класса.Предполагается, что вы используете 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"/>
...