B4A-Bridge and Android 4.1+ logs

Discussion in 'Android Questions' started by Erel, Sep 24, 2012.

  1. Erel

    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: Mar 19, 2014
  2. Inman

    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?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Yes.

    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.
     
  4. Inman

    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?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    adbWireless is only for rooted devices (on such devices B4A-Bridge will also show the full logs).

    Where did you read that this is a built-in feature in Android 4.1?
     
  6. Inman

    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.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    It is not a built-in feature. Just checked with an unrooted Galaxy Nexus running Android 4.1.2.
     
  8. Inman

    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.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    I'm afraid that this is not really possible...

    You can create a small batch file that issues the required ADB call and starts Basic4android.
     
  10. Nenad Trickovic

    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.
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    It is possible that the logs are disabled on your device. Some ROMs disable the logs.

    This is not related to the change in Android 4.1 as there are no messages from B4A-Bridge as well.
     
  12. jefflynn1974

    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...
     
    Azam Rafique likes this.
  13. Erel

    Erel Administrator Staff Member Licensed User

    B4A-Bridge and adb wireless are two different things. If you are connecting over adb wireless then you do not need B4A-Bridge. The app will be installed automatically. This is how it works with adb.
     
    Azam Rafique likes this.
  14. jefflynn1974

    jefflynn1974 Member Licensed User

    Okay, thanks for the informations! :)
     
  15. Rusty

    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
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Are you running in debug mode?
     
  17. 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
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    The debug app sends the log messages to the bridge app through an internal UDP socket. Seems like something is breaking this link.

    I recommend you to switch to USB debug mode to be able to see the logs.
     
  19. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Im seeing logs even when I compile in Relase mode, it is ok?
    Does it affects perfomance?
    Thanks
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    Are you using B4A-Bridge?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice