The FlexbloxLayout tag is simply not working ?
See original GitHub issue- I have searched existing issues and confirmed this is not a duplicate
I install the Flexbox layout and typed the following code in android studio
<com.google.android.flexbox.FlexboxLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:flexWrap="wrap"
app:alignItems="stretch"
app:alignContent="stretch" >
<TextView
android:id="@+id/textview1"
android:layout_width="120dp"
android:layout_height="80dp"
app:layout_flexBasisPercent="50%"
/>
<TextView
android:id="@+id/textview2"
android:layout_width="80dp"
android:layout_height="80dp"
app:layout_alignSelf="center"
/>
<TextView
android:id="@+id/textview3"
android:layout_width="160dp"
android:layout_height="80dp"
app:layout_alignSelf="flex_end"
/>
</com.google.android.flexbox.FlexboxLayout>
But the previwer is unable to display any thing on the screen . When I ran the app even then noting appeared on the phone (just like the previer). The previwer does gives an error though
java.lang.NoClassDefFoundError: android/view/View$OnUnhandledKeyEventListener at com.google.android.flexbox.FlexboxLayout.onLayout_Original(FlexboxLayout.java:564) at com.google.android.flexbox.FlexboxLayout.onLayout(FlexboxLayout.java) at android.view.View.layout_Original(View.java:19659) at android.view.View_Delegate.layout(View_Delegate.java:91) at android.view.View.layout(View.java:19645) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout_Original(View.java:19659) at android.view.View_Delegate.layout(View_Delegate.java:91) at android.view.View.layout(View.java:19645) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083) at android.view.View.layout_Original(View.java:19659) at android.view.View_Delegate.layout(View_Delegate.java:91) at android.view.View.layout(View.java:19645) at android.view.ViewGroup.layout(ViewGroup.java:6075) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:346) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:544) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:678) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:180) at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:61) at org.jetbrains.android.uipreview.ModuleClassLoader.findClass(ModuleClassLoader.java:118) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jetbrains.android.uipreview.ModuleClassLoader.loadClass(ModuleClassLoader.java:213) ... 26 more
I am also using the right version of the library
Version of the flexbox library
flexbox:1.0.0
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Updated android studio tu 3.3, Migrated to android x, successfully compiled the project and launched and tested it. Then decided to try Flexbox and added dependency:
implementation 'com.google.android:flexbox:1.1.0'
pasted in new fragment`s xml and it seems all worked out.
I ended up migrating to android x. It works there (version 1.1.0) . The error was in version 1.0.0 (Without android x). Also I was using android studio 3.2 and 3.3 (The current stable) … to which I have now migrated