Maui android app Compile error: namespace name 'Java' could not be found

Haviv Elbsz 2,071 Reputation points
2022-11-29T08:49:40.153+00:00

Hi all

My project is build and run
but I have 2 problems

  1. Although the app builds and run fine I get the following error:

Severity Code Description Project File Line Suppression State Error CS0246

The type or namespace name 'Java' could not be found
(are you missing a using directive or an assembly reference?)

RazKmoShed (net7.0-ios), RazKmoShed (net7.0-maccatalyst),
RazKmoShed (net7.0-windows10.0.19041.0)
C:_nx11_._Dev\maui\RazKmoShed\RazKmoShed\MainPage.xaml.cs 19 Active

2 . In the running app I have 2 scroll sections
the first responds as expected scroll
horizontally and verticaliy. the second section scroll only vertically

This is the section that respond ok

   <ScrollView Orientation="Vertical" HeightRequest="250"  
                   BackgroundColor="OldLace"  
                   VerticalScrollBarVisibility="Always" >  
               <ScrollView Orientation="Horizontal"  
                   HorizontalScrollBarVisibility="Always" >  
                       <Label x:Name="OutputTB1" Text=""  
                            FontSize="16"  
                            TextColor="Black"  
                            FontAttributes="Bold"  
                            FontFamily="NCourier"  
                            MinimumWidthRequest="-1"  
                             >  
                       </Label>  
               </ScrollView>  
           </ScrollView>  

This is the section that not respond ok

   <ScrollView x:Name="scroll" HeightRequest="450" Orientation="Vertical"  
                           BackgroundColor="LightGreen" VerticalScrollBarVisibility="Always" >  
                   <ScrollView Orientation="Horizontal"  
                               HorizontalScrollBarVisibility="Always" >  
                       <Label  x:Name="OutputTB" Text=""  
                            FontSize="16"  
                            TextColor="Black"  
                            FontAttributes="Bold"  
                            FontFamily="NCourier"  
                            MinimumWidthRequest="-1"  
                             >  
                       </Label>  
     
                   </ScrollView>  
               </ScrollView>  

This is my xaml code:

   <?xml version="1.0" encoding="utf-8" ?>  
   <!-- 16_26112022 -->  
   <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"  
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"  
                x:Class="RazKmoShed.MainPage" Loaded="MainPage_Loaded" x:Name="myContentPage"  
                FlowDirection="LeftToRight" BackgroundColor="Azure" >  
     
       <ScrollView x:Name="topscroll">  
           <VerticalStackLayout x:Name="vLayout" Margin="10" Spacing="5" >  
     
               <Picker x:Name="ExamplesCombo" SelectedIndexChanged="ExamplesCombo_SelectedIndexChanged"  
                           HorizontalTextAlignment="Center" BackgroundColor="Chartreuse"  
                           Title="Select Help Example" TitleColor="Black" FontAttributes="Bold" >  
                   <Picker.ItemsSource>  
                       <x:Array Type="{x:Type x:String}">  
                           <x:String>Mul    Example 1</x:String>  
                           <x:String>Mul    Example 2</x:String>  
                           <x:String>Mul    Example 3</x:String>  
                           <x:String>Mul    Example 4</x:String>  
                           <x:String>Mul    Example 5</x:String>  
                           <x:String>Mul    Example 6</x:String>  
                           <x:String>Mul    Example 7</x:String>  
                           <x:String>Mul    Example 8</x:String>  
                           <x:String>Mul    Example 9</x:String>  
                           <x:String>Mul    Example 10</x:String>  
                           <x:String>Mul    Example 11</x:String>  
                           <x:String>Div    Example 1</x:String>  
                           <x:String>Div    Example 2</x:String>  
                           <x:String>Div    Example 3</x:String>  
                           <x:String>Div    Example 4</x:String>  
                           <x:String>Div    Example 5</x:String>  
                           <x:String>Div    Example 6</x:String>  
                           <x:String>Div    Example 7</x:String>  
                           <x:String>Div    Example 8</x:String>  
                           <x:String>Div    Example 9</x:String>  
                           <x:String>Div    Example 10</x:String>  
                           <x:String>Div    Example 11</x:String>  
                           <x:String>Div    Example 12</x:String>  
                           <x:String>Div    Example 13</x:String>  
                           <x:String>Div    Example 14</x:String>  
                           <x:String>AddSub Example 1</x:String>  
                           <x:String>AddSub Example 2</x:String>  
                           <x:String>Add    Example 1</x:String>  
                           <x:String>Add    Example 2</x:String>  
                           <x:String>Add    Example 3</x:String>  
                           <x:String>Add    Example 4</x:String>  
                           <x:String>Sub    Example 1</x:String>  
                           <x:String>Sub    Example 2</x:String>  
                           <x:String>Sqr    Example 1</x:String>  
                           <x:String>Sqr    Example 2</x:String>  
                       </x:Array>  
                   </Picker.ItemsSource>  
               </Picker>  
     
               <Picker x:Name="ShortOPCombo" SelectedIndexChanged="ShortOPCombo_SelectedIndexChanged"  
                           HorizontalTextAlignment="Center" BackgroundColor="Pink"  
                           Title="Select Puzzle Type" TitleColor="Black" FontAttributes="Bold" >  
                   <Picker.ItemsSource>  
                       <x:Array Type="{x:Type x:String}">  
                           <x:String>Mul Puzzle</x:String>  
                           <x:String>Div Puzzle</x:String>  
                           <x:String>AddSub Puzzle</x:String>  
                           <x:String>Add Puzzle</x:String>  
                           <x:String>Sub Puzzle</x:String>  
                           <x:String>Sqr Puzzle</x:String>  
                       </x:Array>  
                   </Picker.ItemsSource>  
               </Picker>  
     
               <Picker x:Name="nonParticipantcombo" SelectedIndexChanged="nonParticipantcombo_SelectedIndexChanged"  
                           HorizontalTextAlignment="Center" BackgroundColor="Orange"  
                           Title="Select Non Participants Digits" TitleColor="Black" FontAttributes="Bold" >  
                   <Picker.ItemsSource>  
                       <x:Array Type="{x:Type x:String}">  
                           <x:String>Use Any Non Participants Digits</x:String>  
                           <x:String>Use 0 Non Participants Digits</x:String>  
                           <x:String>Use 1 Non Participants Digits</x:String>  
                           <x:String>Use 2 Non Participants Digits</x:String>  
                           <x:String>Use 3 Non Participants Digits</x:String>  
                           <x:String>Use 4 Non Participants Digits</x:String>  
                           <x:String>Use 5 Non Participants Digits</x:String>  
                           <x:String>Use 6 Non participants Digits</x:String>  
                           <x:String>Use 7 Non participants Digits</x:String>  
                           <x:String>Use 8 Non participants Digits</x:String>  
                           <x:String>Use 9 Non participants Digits</x:String>  
                       </x:Array>  
                   </Picker.ItemsSource>  
               </Picker>  
     
           <ScrollView Orientation="Vertical" HeightRequest="250"  
                   BackgroundColor="OldLace"  
                   VerticalScrollBarVisibility="Always" >  
               <ScrollView Orientation="Horizontal"  
                   HorizontalScrollBarVisibility="Always" >  
                       <Label x:Name="OutputTB1" Text=""  
                            FontSize="16"  
                            TextColor="Black"  
                            FontAttributes="Bold"  
                            FontFamily="NCourier"  
                            MinimumWidthRequest="-1"  
                             >  
                       </Label>  
               </ScrollView>  
           </ScrollView>  
     
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="L2RAlfaBetCKB" IsChecked="False"  
                         CheckedChanged="L2RAlfaBetCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Checked = RightToLeft Writing" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <Editor x:Name="InputTB"   
                           BackgroundColor="LightSkyBlue" FontSize="16" FlowDirection="LeftToRight"  
                           TextChanged="InputTB_TextChanged" TextColor="Black"  
                           Placeholder=""  
                           FontAttributes="Bold"  
                           PlaceholderColor="Blue" FontFamily="NCourier"  
                           HorizontalOptions="Fill" VerticalOptions="Start"   
                           HeightRequest="500" WidthRequest="320" >  
               </Editor>  
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="useDigitsItselfCKB" IsChecked="False"  
                         CheckedChanged="useDigitsItselfCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Use Digit Itself Value" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="alphaCKB" IsChecked="False"  
                         CheckedChanged="alphaCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Alpha Free" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="fromToCKB" IsChecked="False"  
                         CheckedChanged="fromToCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Asterisk Free" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="UseOddsEvensCKB" IsChecked="False"  
                         CheckedChanged="UseOddsEvensCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="EO Use Evens and Odds" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout >  
                   <CheckBox x:Name="shiftingsCKB" IsChecked="False"  
                         CheckedChanged="shiftingsCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Use Terms Shiftings" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <CheckBox x:Name="ZerosCKB" IsChecked="False"  
                         CheckedChanged="ZerosCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label    Text="Remove Zero Terms >" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <Entry   x:Name="MaxZeroTermsTB" HorizontalOptions="FillAndExpand"  
                            BackgroundColor="Cyan"  MinimumWidthRequest="300" FontAttributes="Bold"                   
                            Text="0    " TextChanged="MaxZeroTermsTB_TextChanged" />  
     
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <CheckBox x:Name="UseFromDigitsCKB" IsChecked="False"  
                         CheckedChanged="UseFromDigitsCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label Text="Use These Digits ==>" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <Entry   x:Name="UseFromDigitsTB" HorizontalOptions="FillAndExpand"  
                            BackgroundColor="Cyan" MinimumWidthRequest="300" FontAttributes="Bold"                   
                            Text="*4 1 2 3 4    " TextChanged="UseFromDigitsTB_TextChanged" />  
     
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <CheckBox x:Name="UseRepetitionCKB" IsChecked="False"  
                         CheckedChanged="UseRepetitionCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label Text="Use Digit Repeat ==>" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
     
                   <Entry   x:Name="UseRepetitionTB" HorizontalOptions="FillAndExpand"  
                            BackgroundColor="Cyan"  MinimumWidthRequest="300" FontAttributes="Bold"                   
                            Text="= 24    " TextChanged="UseRepetitionTB_TextChanged" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <CheckBox x:Name="TermsDiffDigitsCKB" IsChecked="False"  
                         CheckedChanged="TermsDiffDigitsCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label Text="Use Terms Diff Digits ==>" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <Entry   x:Name="TermsDiffDigitsTB" HorizontalOptions="FillAndExpand"  
                            BackgroundColor="Cyan"  MinimumWidthRequest="300" FontAttributes="Bold"                   
                            Text="= 2 0 ! 3 1 = 4 2    " TextChanged="TermsDiffDigitsTB_TextChanged" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <CheckBox x:Name="NCommonCKB" IsChecked="False"  
                         CheckedChanged="NCommonCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
     
                   <Label Text="Use Terms nCommon ==>" FontAttributes="Bold"           
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <Entry   x:Name="NCommonTB" HorizontalOptions="FillAndExpand"  
                            BackgroundColor="Cyan"  MinimumWidthRequest="300" FontAttributes="Bold"                   
                            Text="0 2 0 1 2 3    " TextChanged="NCommonTB_TextChanged" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout Spacing="10" >  
                   <Label HorizontalOptions="Start" VerticalOptions="Center"  
                          FontAttributes="Bold"  
                          Text="Calculation Number System Base" />  
     
                   <Entry   x:Name="baseXTB"  HorizontalOptions="FillAndExpand" Text="10    "  
                            BackgroundColor="Cyan"  MinimumWidthRequest="300" FontAttributes="Bold"  
                            TextChanged="baseXTB_TextChanged" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
                 
               <HorizontalStackLayout >  
                   <Label    Text="Keep Last Solutions" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <CheckBox x:Name="KeepSolutionsCKB" IsChecked="False"  
                         CheckedChanged="KeepSolutionsCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <HorizontalStackLayout >  
                   <Label    Text="Show Help / Clear Help" FontAttributes="Bold"  
                         HorizontalOptions="Start" VerticalOptions="Center" />  
     
                   <CheckBox x:Name="ShowHelpCKB" IsChecked="False"  
                         CheckedChanged="ShowHelpCKB_CheckedChanged"  
                         HorizontalOptions="Center" VerticalOptions="Center" />  
               </HorizontalStackLayout>  
     
               <ScrollView x:Name="scroll" HeightRequest="450" Orientation="Vertical"  
                           BackgroundColor="LightGreen" VerticalScrollBarVisibility="Always" >  
                   <ScrollView Orientation="Horizontal"  
                               HorizontalScrollBarVisibility="Always" >  
                       <Label  x:Name="OutputTB" Text=""  
                            FontSize="16"  
                            TextColor="Black"  
                            FontAttributes="Bold"  
                            FontFamily="NCourier"  
                            MinimumWidthRequest="-1"  
                             >  
                       </Label>  
     
                   </ScrollView>  
               </ScrollView>  
     
               <ProgressBar x:Name="progressBar"  Progress="0"  
                            ProgressColor="Blue" BackgroundColor="Aqua" />  
     
               <Button  x:Name="RunButton" Text="Start" BackgroundColor="#512BD4"  
                         HorizontalOptions="Center" VerticalOptions="Center"  
                         CornerRadius="20" BorderColor="Black" TextColor="White"  
                         BorderWidth="2" HeightRequest="40" WidthRequest="140"  
                         Clicked="RunButton_Clicked" FontAttributes="Bold" />  
                             
               <Label HorizontalOptions="Center" VerticalOptions="Center"  
                          FontAttributes="Bold"  
                          Text="Solutions Window" />  
     
           </VerticalStackLayout>  
       </ScrollView>  
     
   </ContentPage>  

Help me to fix these problems

Thank you very much

Developer technologies .NET .NET MAUI
Developer technologies C#
{count} votes

Accepted answer
  1. Anonymous
    2022-11-30T02:45:44.677+00:00

    I tested your code, two nested scrollview could be scrolled vertically and horizontally.
    Do you have too much character in your scrollview? Please add following text in label to your Scrollview, is that working?
    Which platform is not working when running code?
    Please share your MAUI and VS version.
    Try to remove the widthrequest of the horizontal stack layout.

    265535-testtext.txt


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.