B4A-Bridge and Android 4.1+ logs

Erel

Administrator
Staff member
Licensed User
Google has removed the READ_LOGS permission from Android 4.1+. This means that a running app cannot read any log messages except of its own messages.

This change affects B4A-Bridge which reads the logs and sends them to the IDE. It doesn't affect the logs when the device is connected in USB debugging mode.

To workaround this limitation, a new version of B4A-Bridge was released - v2.07. In this version B4A-Bridge opens a local UDP port (on Android 4.1+ only). Other Basic4android apps that run in debug mode will now send each log message to B4A-Bridge UDP port. B4A-Bridge writes the message to the log which is then sent to the IDE.
 
Last edited:

Inman

Well-Known Member
Licensed User
I am facing this issue after I updated my Galaxy Note to Android 4.1.2 CM10 based ROM.

Does the new logging procedure work only in debug mode? Because I can't get it to work on release mode.

And some of my projects are big, with over 10,000 lines of code and it takes very long time to compile in debug mode. Is it possible to access the logs in normal mode?
 

Erel

Administrator
Staff member
Licensed User
Does the new logging procedure work only in debug mode?
Yes.

Is it possible to access the logs in normal mode?
Not if you are using B4A-Bridge. Only if you are connected in USB debug mode.

I believe that the next version (one after v2.30) will allow you to exclude modules from the debugger thus making it easier to debug large projects.
 

Inman

Well-Known Member
Licensed User
That is nice.

One thing I realised yesterday was that you can connect in USB debug mode via ADB wirelessly (which is built in on Android 4.1+ or using adbWireless app from Play Store for other Android versions) and everything works, including logging in normal mode. But every time you open B4A, you need to connect to adb from a command prompt using "adb connect ipaddress : port" command manually.

Will it be possible for you to add a new Adb Wireless option in the Tools menu of B4A, where you could receive a text input from the user for ip address and port and then connect using adb connect command?
 

Inman

Well-Known Member
Licensed User
You are right, adbWireless worked for me because my phone is rooted. But B4A-Bridge is not showing the logs in normal mode and I don't remember it requesting root permission either.

And yea it might not be a built-in feature for Android 4.1. I can see it on my phone but since the ROM I am using is based on CyanogenMod 10, it could very well be a feature of CM10, although it is given among Developer Options that are present on all Android builds.
 

Inman

Well-Known Member
Licensed User
Alright. But could you please add the Adb Wireless option for rooted users like me? You could hide the option deep inside some menu so that regular users won't get confused.
 

Nenad Trickovic

Member
Licensed User
With my device Cubot GT72 Android 4.2 log pane is empty.

This is the only message I see

LogCat connected to: B4A-Bridge: CUBOT CUBOT GT72E-359939042471793
--------- beginning of /dev/log/main
mWifiServiceMessenger == null


Debugging works fine with HTC Desire Android 4.0.
 

jefflynn1974

Member
Licensed User
I have a question about this topic. I am using the Bridge via the adb wireless which is a built in feature in my Cyanogenmod 10.1.3 ROM. I find this way more comfortable for example it is not necessary to connect apiece again and again all projects with the device and there is no other way to see the logs for me.
But I noticed something interesting thing. When I send a project to my phone it is installed automatically and missing out that screen which ask me am I want to install the app and runs it immediately. Is this normal in this type of use or can I disable it? I am not very happy about this automatical first running of my application...
 

Rusty

Well-Known Member
Licensed User
I've updated my B4ABridge to 2.12 and installed it on my KitKat device, still no logs. I do get the following when completely unfiltered:
LogCat connected to: B4A-Bridge: alps M-1000Q
--------- beginning of /dev/log/main
mWifiServiceMessenger == null

I've looked in the device for anything that remotely looks like a log setting and can't find anything.
Any advice?
thanks
Rusty
 

Rusty

Well-Known Member
Licensed User
I have the same results in Debug Legacy and in Debug Rapid.
Yes, I'm in debug mode
Thanks
Rusty
 
Top