This question already has answers here:
How to implement OnFragmentInteractionListener
(12 answers)
Closed 4 years ago.
In starting my activity called Home Screen, the app crashes in trying to read the XML file at line 36, with the following error:
Binary XML file line #36: Error inflating class fragment
<fragment
android:name="com.example.myName.myApp.EventsFragment"
android:id="#+id/events_frag"
android:layout_width="match_parent"
android:layout_height="464dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
The top line is line 36, which defines a fragment within my home screen activity xml file. Below is the stack trace for the execution so far.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myName.myApp, PID: 15937
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.braedanshigley.feelbettertogether/com.example.braedanshigley.feelbettertogether.HomeScreen}: android.view.InflateException: Binary XML file line #36: Binary XML file line #36: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #36: Binary XML file line #36: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class fragment
Caused by: java.lang.RuntimeException: com.example.braedanshigley.feelbettertogether.HomeScreen#d0dbff6 must implement OnFragmentInteractionListener
at com.example.braedanshigley.feelbettertogether.EventsFragment.onAttach(EventsFragment.java:83)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1372)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1659)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1905)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3715)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:114)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:374)
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:68)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
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 android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.braedanshigley.feelbettertogether.HomeScreen.onCreate(HomeScreen.java:24)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
You need to implement OnFragmentInteractionListener in your HomeScreen. Java activity. That listener implementation is missing due to which you are getting that crash.
This log is clearly stating that:
Caused by: java.lang.RuntimeException: com.example.braedanshigley.feelbettertogether.HomeScreen#d0dbff6 must implement OnFragmentInteractionListener
Hello does your fragment name package correct?
com.example.myName.myApp.EventsFragment this one need to be the one on top of the Fragment class
Related
After Adding zoom sdk BottomNavigationView is crashing.
[ZoomSDKImlementation][1] https://marketplace.zoom.us/docs/sdk/native-sdks/android/build-an-app/
Here I found the problem with menu. If I removed app:menu error will gone, But menu is needed for sure.
api 'com.google.android.material:material:1.4.0'
Issue from Xml Design Tab
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="#color/colorPrimary"
app:itemIconTint="#color/bottom_nav_item_colors"
app:itemTextColor="#color/bottom_nav_item_colors"
app:labelVisibilityMode="selected"
app:menu="#menu/calf_bottom_navigation" />
at com.google.android.material.navigation.NavigationBarItemView.<init>(NavigationBarItemView.java:107)
at com.google.android.material.bottomnavigation.BottomNavigationItemView.<init>(BottomNavigationItemView.java:34)
at com.google.android.material.bottomnavigation.BottomNavigationMenuView.createNavigationBarItemView(BottomNavigationMenuView.java:197)
at com.google.android.material.navigation.NavigationBarMenuView.getNewItem(NavigationBarMenuView.java:492)
at com.google.android.material.navigation.NavigationBarMenuView.buildMenuView(NavigationBarMenuView.java:421)
at com.google.android.material.navigation.NavigationBarPresenter.updateMenuView(NavigationBarPresenter.java:72)
at com.google.android.material.navigation.NavigationBarView.inflateMenu(NavigationBarView.java:358)
at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:226)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:93)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:399)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:189)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:147)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:303)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1121)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:353)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:431)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:714)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$7(RenderTask.java:870)
at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:187)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Stacktrace when run the app
2022-02-17 16:24:16.909 6448-6448/com.lakshya.academy E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lakshya.academy, PID: 6448
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lakshya.academy/com.nuveda.calf.ui.participant.activity.ParticipantHomeActivity}: android.view.InflateException: Binary XML file line #115: Binary XML file line #115: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #115: Binary XML file line #115: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
Caused by: android.view.InflateException: Binary XML file line #115: Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
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 androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.nuveda.calf.ui.participant.activity.ParticipantHomeActivity.onCreate(ParticipantHomeActivity.kt:82)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getPaddingBottom()' on a null object reference
at com.google.android.material.navigation.NavigationBarItemView.<init>(NavigationBarItemView.java:107)
at com.google.android.material.bottomnavigation.BottomNavigationItemView.<init>(BottomNavigationItemView.java:34)
at com.google.android.material.bottomnavigation.BottomNavigationMenuView.createNavigationBarItemView(BottomNavigationMenuView.java:197)
at com.google.android.material.navigation.NavigationBarMenuView.getNewItem(NavigationBarMenuView.java:492)
at com.google.android.material.navigation.NavigationBarMenuView.buildMenuView(NavigationBarMenuView.java:421)
2022-02-17 16:24:16.910 6448-6448/com.lakshya.academy E/AndroidRuntime: at com.google.android.material.navigation.NavigationBarPresenter.updateMenuView(NavigationBarPresenter.java:72)
at com.google.android.material.navigation.NavigationBarView.inflateMenu(NavigationBarView.java:358)
at com.google.android.material.navigation.NavigationBarView.<init>(NavigationBarView.java:226)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:103)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:98)
at com.google.android.material.bottomnavigation.BottomNavigationView.<init>(BottomNavigationView.java:93)```
[1]: https://marketplace.zoom.us/docs/sdk/native-sdks/android/build-an-app
I've created a fresh new app using the Empty Activity Template. Then I went to the almost empty main_activity.xml and pasted your BottomSheet.
I added your dependency to build.gradle.
I fixed the missing things:
constrains so the COnstraintLayout doesn't scream at me.
Colors, I picked random colors that come with Android.
Menu: you didn't supply this one, but I have the impression this is where your problem could be. Mine is empty, as I don't know what's in yours.
Theme: I changed the default from the template (DayNight) to Light.
And... it runs.
So, I'd start from this empty project, adding your bits one by one until you figure out what is crashing your inflation process.
Why do I think your menu is involved?
If you look at your stacktrace, the BottomNavigationView is calling its constructor init() and part of this involves inflating the menu items:
at NavigationBarItemView.<init>(NavigationBarItemView.java:107)
at BottomNavigationItemView.<init>(BottomNavigationItemView.java:34)
at BottomNavigationMenuView.createNavigationBarItemView(BottomNavigationMenuView.java:197)
at NavigationBarMenuView.getNewItem(NavigationBarMenuView.java:492)
at NavigationBarMenuView.buildMenuView(NavigationBarMenuView.java:421)
at.NavigationBarPresenter.updateMenuView(NavigationBarPresenter.java:72)
at NavigationBarView.inflateMenu(NavigationBarView.java:358)
at NavigationBarView.<init>(NavigationBarView.java:226)
Here's my sample project running:
If you are still facing this issue, it is probably being caused due to a custom implementation of an older version of design_bottom_navigation_item.xml file either in your codebase or in the SDK. This file was updated in version 1.3.0 and again in 1.4.0 of Material Component Library. Overriding it with an incompatible version will cause the app to crash.
I've researched through the rest of the answers, but they all seem to suggest updating dependencies etc. However I'm developing for SDK 28, everything is up to date, and has been checked via Android Studio, so there would appear to be another cause.
Basically I have added a Floating Action Button via XML:
<android.support.design.widget.FloatingActionButton
android:id="#+id/dict_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="#drawable/ic_add_circle_black_24dp"
android:layout_margin="16dp" />
And get the below crash when I try to load the activity containing the FAB.
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: uk.ac.aber.dcs.haa14.assignment, PID: 2876
java.lang.RuntimeException: Unable to start activity ComponentInfo{uk.ac.aber.dcs.haa14.assignment/uk.ac.aber.dcs.haa14.assignment.ui.DictionaryActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.design.widget.FloatingActionButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class android.support.design.widget.FloatingActionButton
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class android.support.design.widget.FloatingActionButton
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.FloatingActionButton" on path: DexPathList[[zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/base.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_dependencies_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_resources_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_0_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_1_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_2_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_3_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_4_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_5_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_6_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_7_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_8_apk.apk", zip file "/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:606)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
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 android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at uk.ac.aber.dcs.haa14.assignment.ui.DictionaryActivity.onCreate(DictionaryActivity.java:32)
E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/uk.ac.aber.dcs.haa14.assignment-5Y5qp-mx6ITFeGrYdObqMQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:727)
at android.app.LoadedApk.getResources(LoadedApk.java:954)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2270)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5639)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
... 6 more
Application terminated.
add implementation 'com.android.support:design:27.1.0' into app/build.gradle where all other dependencies are.
I have trouble with account kit, it crashes on entering phone number screen in split screen mode.
Im using next dependencies with last versions.
implementation 'com.facebook.android:account-kit-sdk:4.34.0'
Here is stacktrace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appname.dev, PID: 25576
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appname.dev/com.facebook.accountkit.ui.AccountKitActivity}: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class TextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4778)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1611)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6637)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #26: Binary XML file line #26: Error inflating class TextView
Caused by: android.view.InflateException: Binary XML file line #26: Error inflating class TextView
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 37 to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at android.view.View.<init>(View.java:4998)
at android.widget.TextView.<init>(TextView.java:824)
at android.widget.TextView.<init>(TextView.java:818)
at android.support.v7.widget.ab.<init>(AppCompatTextView.java:76)
at android.support.v7.widget.ab.<init>(AppCompatTextView.java:72)
at android.support.v7.app.AppCompatViewInflater.a(AppCompatViewInflater.java:176)
at android.support.v7.app.AppCompatViewInflater.a(AppCompatViewInflater.java:101)
at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:1035)
at android.support.v7.app.j.onCreateView(AppCompatDelegateImplV9.java:1092)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.facebook.accountkit.ui.be$a.a(TitleFragmentFactory.java:87)
at com.facebook.accountkit.ui.ai.onCreateView(LoginFragment.java:43)
at com.facebook.accountkit.ui.be$a.onCreateView(TitleFragmentFactory.java:50)
at android.app.Fragment.performCreateView(Fragment.java:2611)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1276)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1549)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1611)
at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3039)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2991)
at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178)
at android.app.Activity.performCreateCommon(Activity.java:6969)
at android.app.Activity.performCreate(Activity.java:6977)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2784)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4778)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1611)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6637)
E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Android 8.0
Xiaomi Mi A1
I need to use firebase-ui-auth in my programm...
// Choose authentication providers
List providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build());
// Create and launch sign-in intent
caller.startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);`
and function very good (I call this in my mainActivity)...
but, when I choose only: AuthUI.IdpConfig.EmailBuilder() the app crashes, because there is some problem to inflate xml...
error code:
Process: com.superena.superenaactivity, PID: 6516
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.superena.superenaactivity/com.firebase.ui.auth.ui.email.EmailActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class android.support.design.widget.TextInputLayout
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.firebase.ui.auth.ui.email.CheckEmailFragment.onCreateView(CheckEmailFragment.java:89)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2335)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1423)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1754)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1822)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2591)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2378)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2333)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2240)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3243)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3195)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:596)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7029)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2741)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
06-27 12:54:24.320 6516-6516/com.superena.superenaactivity E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoSuchFieldError: No static field error_color_material of type I in class Landroid/support/v7/appcompat/R$color; or its superclasses (declaration of 'android.support.v7.appcompat.R$color' appears in /data/app/com.superena.superenaactivity-reFM-WL6EH7D2KJRxYTXFw==/split_lib_slice_2_apk.apk)
at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:654)
at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:257)
at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:187)
... 40 more
with the two options it works very well; with only new AuthUI.IdpConfig.EmailBuilder().build());don't functions, if somebody can help me, please
I face same problem. Solved it by adding this
compile 'com.android.support:design:28.0.0'
into dependencies of app level gradle file.
When running a proguard enabled build with the new android navigation component, my fragment class cannot be found. I receive this stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapppackage.path, PID: 24334
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapppackage.path/com.myapppackage.path.MainActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
Caused by: java.lang.RuntimeException: Exception inflating com.myapppackage.path:navigation/nav_graph line 7
at androidx.navigation.h.a(Unknown Source:124)
at androidx.navigation.c.a(Unknown Source:4)
at androidx.navigation.fragment.NavHostFragment.a(Unknown Source:88)
at android.support.v4.app.g.k(Unknown Source:15)
at android.support.v4.app.m.a(Unknown Source:382)
at android.support.v4.app.m.b(Unknown Source:7)
at android.support.v4.app.m.a(Unknown Source:74)
at android.support.v4.app.m.onCreateView(Unknown Source:216)
at android.support.v4.app.j.a(Unknown Source:4)
at android.support.v4.app.h.a(Unknown Source:2)
at android.support.v4.app.e.onCreateView(Unknown Source:0)
at android.support.v4.app.h.onCreateView(Unknown Source:0)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
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 android.support.v7.app.j.b(Unknown Source:23)
at android.support.v7.app.c.setContentView(Unknown Source:4)
at com.myapppackage.path.MainActivity.onCreate(Unknown Source:6)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
at androidx.navigation.fragment.a$a.a(Unknown Source:58)
at androidx.navigation.fragment.a$a.a(Unknown Source:19)
at androidx.navigation.h.a(Unknown Source:16)
at androidx.navigation.h.a(Unknown Source:133)
at androidx.navigation.h.a(Unknown Source:31)
at androidx.navigation.c.a(Unknown Source:4)
at androidx.navigation.fragment.NavHostFragment.a(Unknown Source:88)
at android.support.v4.app.g.k(Unknown Source:15)
at android.support.v4.app.m.a(Unknown Source:382)
at android.support.v4.app.m.b(Unknown Source:7)
at android.support.v4.app.m.a(Unknown Source:74)
at android.support.v4.app.m.onCreateView(Unknown Source:216)
at android.support.v4.app.j.a(Unknown Source:4)
at android.support.v4.app.h.a(Unknown Source:2)
at android.support.v4.app.e.onCreateView(Unknown Source:0)
at android.support.v4.app.h.onCreateView(Unknown Source:0)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
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 android.support.v7.app.j.b(Unknown Source:23)
at android.support.v7.app.c.setContentView(Unknown Source:4)
at com.myapppackage.path.MainActivity.onCreate(Unknown Source:6)
at android.app.Activity.performCreate(Activity.java:6999)
at android.app.Activity.performCreate(Activity.java:6990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
E/AndroidRuntime: at androidx.navigation.fragment.a$a.a(Unknown Source:45)
... 38 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapppackage.path.ui.start.StartFragment" on path: DexPathList[[zip file "/data/app/com.myapppackage.path-yqk9eOoCoeyT3xg78oYcxg==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapppackage.path-yqk9eOoCoeyT3xg78oYcxg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 41 more
It says it cannot find the fragment class which is defined in my nav_graph.xml file:
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.myapppackage.path.ui.start.StartFragment
My nav_graph.xml:
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
app:startDestination="#id/start">
<fragment
android:id="#+id/start"
android:name="com.myapppackage.path.ui.start.StartFragment"
android:label="start_fragment"
tools:layout="#layout/start_fragment" />
</navigation>
As you can see the name of the fragment is set in the xml, this path seems to become invalid after running through proguard.
My only work-around so far is to define each of my fragment class paths as -keepnames in my proguard-rules.pro file. For example:
-keepnames class com.myapppackage.path.ui.start.StartFragment
After this, the obfuscated compile runs fine without crashing.
Although I'm not sure if this is correct, am I doing something wrong?
How can we use the new navigation architecture component with our obfuscated builds without defining a rule for each fragment in proguard rules?
I understand this issue may only be a problem right now because the navigation-fragment component is still in alpha.