flexbox-layout icon indicating copy to clipboard operation
flexbox-layout copied to clipboard

The FlexbloxLayout tag is simply not working ?

Open Aryanr64x opened this issue 5 years ago • 6 comments

  • [x] 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

Aryanr64x avatar Dec 03 '18 16:12 Aryanr64x

I could confirm that issue is valid in flexbox version 1.1.0. How could we be certain that it is issue with flex library or IDE itself?

vsd-codesode avatar Dec 08 '18 07:12 vsd-codesode

@vsd-codesode This is because because when I launch the app in my android device it still does not shows anything there. Hence its not only an IDE problem

Aryanr64x avatar Dec 08 '18 15:12 Aryanr64x

Hi,

Thanks for the report.

The issue that nothing appeared is highly likely an issue with the Android Studio. If so, could you report the issue to the Android Studio issue tracker?

If the issue that nothing appeared on the phone is reproducible, it's an issue with the flexbox-layout library. But I couldn't reproduce it on my phone. Is the issue that nothing appeared on your phone still reproducible?

thagikura avatar Jan 11 '19 08:01 thagikura

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

Aryanr64x avatar Jan 18 '19 15:01 Aryanr64x

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.

SmileHub avatar Jan 29 '19 12:01 SmileHub

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.

After many hours stucking in this issue, this one worked for me!

Ozaoujal avatar Jul 13 '23 15:07 Ozaoujal