Modifer.align() not working for text in Row / Column / Box . Unresolved Scope Instance errors

Using Android Studio Giraffe 2022.3.1 So using the preset recommended compiler with this version of android studio

Finding Contradicting online information on .align() being able to be used in Column/Row Scope. Some say it doesn't work or only works inside BoxScope.

Yet the android developer introduction CODELAB uses this code and recommends this usage of Modifier.align() in columnScope which throws the same errors:


Cannot access 'ColumnScopeInstance': it is internal in ''

Unresolved reference: End

import // import causing the first error
{                            //Column Scope
                text = message,
                fontSize = 100.sp,
                lineHeight = 116.sp,
                textAlign = TextAlign.Center
                text = from,
                fontSize = 36.sp,
                modifier = Modifier
                    .align(Alignment.End), // Error on this line
                textAlign = TextAlign.Left


  • align() can be used for Row,Box and Column. It is a misconception that align() only works for box type.



    .align() is available under the same name under 3 types

    1)Alignment.Horizontal ----> Use inside Column Scope

    2)Alignment.Vertical ----> Use inside Row Scope

    3)Alignment(There is no extra description) ----> Use inside Box Scope


    Use the proper Alignment androidx.compose.ui.Alignment argument inside align() make sure you are using this:


    III. ( Not needed to follow this if there is no import error)

    If you have already tried importing you would this in your import statements :


    REMOVE it.


    The Issue is the 'overloading' of the Code Completion inteli-sense.

    The same key word "Alignment" would sometimes be used for Layout.Alignment and other times it would be used androidx.compose.ui.Alignment.

    Inteli-sense is good at understanding this and matches this to the correct type. Yet sometimes it does not work very well so we get the errors. Similarly the align() function has a vertical,horizontal and normal context and inteli-sense can also mismatch the scope with the context.

    My Specific SOLUTION

    Solved the issue in a column scope. Also I used align in a horizontal context.

    ColumnScope Align

    Make sure this is the Alignment used !


    Different types of Alignments Alignment

    In my IDE Alignment keyword was taken up by the Layout.Alignment

    So don't blindly follow inteli-sense, also just starting to learn android development doesn't help ;).

    P.S : The Myth that align() somehow only works in box can be traced to this.