question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The FlexbloxLayout tag is simply not working ?

See original GitHub issue

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:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SmileHubcommented, Jan 29, 2019

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.

0reactions
Aryanr64xcommented, Jan 18, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

FlexBoxLayout align-self:flex-end not working in nativescript-vue
in my nativescript-vue app I'm using flex layout to create a custom ActionBar component to reuse, I'm trying to ge the search icon...
Read more >
Flexbox layout not responsive - Material Design for Bootstrap
Actual behavior The layout is not responsive, the tiles do not stack and the "Query engine" text moves below the icon as the...
Read more >
Flexbox Layout Behavior in Jetpack Compose
Flex direction specifies whether items are arranged vertically or horizontally. Compose has Row and Column composables that work for simple ...
Read more >
Flexing Your HTML Layout Muscles with Flexbox
The content area can then have a horizontal Flexbox layout that contains ... One of the most difficult layout issues to deal with...
Read more >
SVG layout with Flexbox for simpler D3 charts - Scott Logic Blog
This blog looks at how CSS flexbox layout can be applied to SVG in order ... this isn't really a fault of D3,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found