Я работаю над приложением с kotlin и androidx, и я создаю класс настроек, работающий нормально, пока он не обработает sh и выдаст мне эту ошибку в logcat
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.alserdar.evana, PID: 9425
android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class androidx.recyclerview.widget.RecyclerView
Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class androidx.recyclerview.widget.RecyclerView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:658)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at androidx.preference.PreferenceFragmentCompat.onCreateRecyclerView(PreferenceFragmentCompat.java:541)
at androidx.preference.PreferenceFragmentCompat.onCreateView(PreferenceFragmentCompat.java:208)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2698)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:310)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1185)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2167)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1990)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1945)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1847)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2621)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2569)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:247)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:541)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1419)
at android.app.Activity.performStart(Activity.java:7479)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3454)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
at android.os.Handler.dispatchMessage(Handler.java:112)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
Caused by: java.lang.IllegalArgumentException: Providing a LayoutTransition into RecyclerView is not supported. Please use setItemAnimator() instead for animating changes to the items in this RecyclerView
at androidx.recyclerview.widget.RecyclerView.setLayoutTransition(RecyclerView.java:2313)
at android.view.ViewGroup.initFromAttributes(ViewGroup.java:730)
at android.view.ViewGroup.<init>(ViewGroup.java:662)
at android.view.ViewGroup.<init>(ViewGroup.java:655)
, которую я пытался реализовать
implementation "androidx.legacy:legacy-preference-v14:1.0.0"
и implementation 'androidx.core:core-ktx:1.2.0'<br>
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Я действительно все испробовал, и я не знаю, откуда эта ошибка, я даже не использую recycleview
Я пытался удалите этот код строки supportFragmentManager
.beginTransaction()
.replace(R.id.settings, HeaderFragment())
.commit()
это откроет класс, но без представлений ..
мой класс заголовка таков:
<androidx.preference.PreferenceScreen
xmlns:app="http://schemas.android.com/apk/res-auto">
<Preference
app:key="gifts"
app:title="Gifts"
app:icon="@mipmap/gift"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity$Gifts"/>
<Preference
app:key="share"
app:title="Share"
app:icon="@mipmap/share"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity$Share"/>
<Preference
app:key="buy_pin"
app:title="Change Pin"
app:icon="@mipmap/pin_code"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity$SyncFragment"/>
<Preference
app:key="link_accounts"
app:title="Link Accounts"
app:icon="@mipmap/link"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity$LinkAccounts"/>
<Preference
app:key="contact_us"
app:title="Contact Us"
app:icon="@mipmap/messages"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity"/>
<Preference
app:key="add_country"
app:title="Add Country"
app:icon="@mipmap/plus"
app:fragment="com.alserdar.evana.b_home_stuff.setting_stuff.SettingsActivity"/>