Android Question Black screen when running apps

Have followed instructions to the letter, watched numerous tutorials & still no answer after five days of trying. When I run any app(even the simple example) I get the title but just a black screen. No message box appears. I've installed everything that was stated, I've uninstalled and clean installed numerous time. I ran the app in "debug" mode & "compile & run" mode with the same result. I've also tried numerous example apps all with same result, I've also created a layout and generated members but still the same. I'm using a Samsung A5 phone. Any help would be appreciated, there doesn't seem to be any reason why this won't work.
 

Shelby

Active Member
Licensed User
Please tell us how you resolved the problem for our education, etc. I'm learning vicariously through the experiences of others. Thanks
 
Last edited:
It was my own fault really but it's never explained in any tutorial I read/watched. On the same row as as all the icons (toolbar) there are two drop down menus, one with "debug" & one with "default". Change the "debug" box to "release" and that was it it worked. Honestly five days wasted but you live and learn.
 

Peter Simpson

Expert
Licensed User
"debug" box to "release" and that was it it worked.
It should not make any difference really, you should post an example of what you were trying to accomplish.

Debug is extremely important to developing your Android app, without it you WILL find debugging your app almost impossible.

Post the example your were trying and we'll try to help you more, but your project should run in both modes.
 
It is the example when you first open B4A
Main file:
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Msgbox("Welcome to B4A!", "")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
---------------------------------------------------------------------------------------------------------------
Starter file:
B4X:
#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.

End Sub

Sub Service_Start (StartingIntent As Intent)
    

End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy

End Sub
I was just trying to run this example so I changed no code or attributes but this & other apps only work in "release" mode not "debug" mode. I've had no problems running any example apps since running in "release" mode but I understand what you are saying about "debug" mode & will no doubt cause me problems later on. If you could shed some light on this I would be grateful. Thanks for replying
 

DonManfred

Expert
Licensed User
It is the example when you first open B4A
No. there is not MsgBox in Activity_create in a new Project! You did added it.

The black screen is about the fact that you are not loading any Layout to the Activity. Create a layout in the designer and load it in activity_create
B4X:
Activity.LoadLayout("Layout1")
Also worth watching the Videos at https://www.b4x.com/etp.html

First B4A App for example
 
I already created a layout that didn't work, maybe I've installed something wrong but I followed every set of instructions I could find to install correctly, five days I tried to get that example to work and other apps but just a black screen but the minute I put it into "release" mode everything worked. I just can't figure it out. I had already watched the recommended videos, I started with installation & configuration, then introduction, the b4a first app and there was still a black screen until I go into "release" mode.
 
No messages, the log reads Logger connected to: "my phone" next line ------- beginning of main but on a few of the attempts I used to have a load of Java errors in there which are no longer there. There are no other error messages anywhere, all indications show that it should work but it doesn't (well in debug mode it doesn't). I really appreciate the time you're spending on this problem. Thank you
 

Computersmith64

Well-Known Member
Licensed User
I already created a layout that didn't work, maybe I've installed something wrong but I followed every set of instructions I could find to install correctly, five days I tried to get that example to work and other apps but just a black screen but the minute I put it into "release" mode everything worked. I just can't figure it out. I had already watched the recommended videos, I started with installation & configuration, then introduction, the b4a first app and there was still a black screen until I go into "release" mode.
If you are connecting to your device via USB cable, make sure you have enabled developer options on your device & turned on the USB Debugging option - otherwise the B4A debugger won't find it.

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
No messages, the log reads Logger connected to: "my phone" next line ------- beginning of main but on a few of the attempts I used to have a load of Java errors in there which are no longer there. There are no other error messages anywhere, all indications show that it should work but it doesn't (well in debug mode it doesn't). I really appreciate the time you're spending on this problem. Thank you
It might be useful if you can copy & paste the contents of the log window to this thread (right click on the log window for options).

- Colin.
 
I tried connected through USB and activated debugger mode - no success. I now use b4a bridge. Since the last clean uninstall/reinstall there is nothing in the log section
 
Top