Android Code Snippet DEBUG - works in debug - crashes in release Example

App Crashes in release - WHY?

The causes are many but in release (over wifi with B4A-Bridge (or Plus) ) you can't see where the issue occurred. With USB debugging (cable connected from PC to Device - and enabled) you can see (in most cases) what crashed your app. This is EXACTLY why I submitted this - it just happened to me.

Here is my case:

As I often do, I create a simple app to test a new... (idea, framework, device to integrate (ie. bluetooth dongle). I carefully code and test this stub to ensure it works (mostly in debug legacy mode so my Log()'s are reported. Then I also test the stub in release mode to ensure I have not overlooked anything.

The majority of times, this works great. However, in this one instance, My release would crash with no reason why... (no debug to tell me). This is where USB connection is SO helpful.

When I plugged in my device to the USB port and compiled my app in release mode, it all became clear.

My app was crashing because I have not provided permissions in the manifest of final app (which were in my test):

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

Which USB connection had indicated in logs...

I had done this in the stub (test) manifest app but not my REAL app. I included lines in manifest and now it works wonderfully, thankfully and as expected...

Lesson: There is (most always) a solution to your problems WHEN you know how to discover them.

After umpteen years of trying to develop robust and error free apps, the B4X framework has succeeded.
Like anything else, you just need to know how to work with it - which isn't difficult.

Thanks
 
Top