I get this error when I use Canvas.SaveAs 
Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
The project is a simple canvas and a save button on an Android device.  The DefaultFileScope is "Shared".
canvas_save_as.aia  (1.6 KB)
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              Try to put name in jpg/jpeg or leave extension blank
12345.png to 12345
 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
            
              @HarshVardhanSolanki  I gave that a try and the problem persists. 
The App Inventor Reference  says: fileName must end with one of “.jpg”, “.jpeg”, or “.png” (which determines the file type: JPEG, or PNG). 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                uskiara  
                
               
               
                 
              
                  
                    September 19, 2024,  6:37pm
                   
                   
              4 
               
             
            
              You shall put an image inside the canvas. 
I did it and it works, for me. 
I just added an image to your code ( .aia attached afterwards). 
The following image is the jpeg image file "12345.jpg" created by your code after the 207.png image has been loaded into the assets 
Give it a try.
canvas_save_as.aia  (333.8 KB)
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                TIMAI2  
                
               
               
              
                  
                    September 19, 2024,  7:05pm
                   
                   
              5 
               
             
            
              You should not need to add an image, setting filescope to Shared will make no difference to where canvasSaveas saves, which will be the ASD when android version > 10. Will probably work on versions before that.
This looks like a bug!
If default filescope is set to Shared in project Properties it generates the above error.
             
            
               
               
              1 Like 
            
            
                 
                 
              
           
          
            
            
              @uskiara  The AIA you shared still has the null object reference  error when I try to save. 
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                uskiara  
                
               
               
              
                  
                    September 19, 2024,  7:30pm
                   
                   
              9 
               
             
            
              Ok sorry, as I said, it works for me, but probably it depends on my Android version (9) which allows me to store files also out of ASD when the filescope is set to Shared. 
Please follow Tim's hints.  Also @Anke  has written a lot about file storage on newer Androids.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                Anke  
                
               
               
              
                  
                    September 19, 2024,  7:41pm
                   
                   
              10 
               
             
            
              
You cannot save a file in the root dir of the external storage on Android 11+, you must save it in one of the Shared folders.
See also here: Some basics on Android storage system 
             
            
               
               
              2 Likes 
            
            
                 
                 
              
           
          
            
              
                Anke  
                
               
               
              
                  
                    September 19, 2024,  7:46pm
                   
                   
              11 
               
             
            
              Note : Saving a file via Canvas to one of the Shared folders by setting DefaultFileScope = Shared or Legacy only works on Screen1.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                TIMAI2  
                
               
               
                 
              
                  
                    September 19, 2024,  7:48pm
                   
                   
              12 
               
             
            
               
(that is a self-deprecating "doh!", by the way...)
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                Anke  
                
               
               
              
                  
                    September 19, 2024,  7:55pm
                   
                   
              13 
               
             
            
              
 TIMAI2:
 
 
 
Yes, but this works only on Screen1.
             
            
               
               
               
            
            
                 
                 
              
           
          
            
              
                TIMAI2  
                
               
               
              
                  
                    September 19, 2024,  8:01pm
                   
                   
              14 
               
             
            
              In truth, i did not know Canvas.SaveAs did that, I understood it to be hardwired to the ASD, regardless of android version / filescope.
That is two things I have learned today 
In the words of Albert Einstein, “once you stop learning, you start dying”.
 
             
            
               
               
              1 Like 
            
            
                 
                 
              
           
          
            
              
                Anke  
                
               
               
              
                  
                    September 19, 2024,  9:57pm
                   
                   
              16 
               
             
            
              
For once I don't agree with Einstein. It should say: "once you stop loving, you start dying".
             
            
               
               
              1 Like 
            
            
                 
                 
              
           
          
            
            
              
That would explain the cause of the error.  Thank you!  And, thanks for keeping the Android Storage thread up-to-date!
Wouldn't this still be considered a bug?  App Inventor shouldn't be attempting to invoke a method on a null object.