Android Tutorial Logcat viewing

The Basic4Android IDE contains a mysterious tab entitled "Logcat" in the right hand pane.

This archive contains a help file that will tell you what a Logcat is and also contains a more sophisticated viewer than the one presently provided by Basic4Android to let you explore your Android system Logcats in a more flexible way.
 

Attachments

  • B4ALogViewer1.2.zip
    16.3 KB · Views: 879

GMan

Well-Known Member
Licensed User
Longtime User
Hoi agraham,
found this tool - but it won't work (any longer?)
 

DonManfred

Expert
Licensed User
Longtime User
You can use Android.SDK\tools\monitor.bat to see the LOG-Cat (and much more)
If you want only the B4A-Output then you have to set a Filter on "Tag" to "B4A"

Did you update your Android-Version in the last time to V4.x?

logcat_filter.png


logcat.png
logcat_filter.png
 
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
Hoi,

no - didnt update.

The error is always: Das System kann die angegebene Datei nicht finden

Reason for that all: i cant see ANY message in the log
 

GMan

Well-Known Member
Licensed User
Longtime User
Is thrre a special folder where the exe has to been placed ?
I put it in the B4A Homepath folder at last

And the monitor.bat closes itself directy after starting
 

warwound

Expert
Licensed User
Longtime User
Hoi agraham,
found this tool - but it won't work (any longer?)

I used to use this log viewer all the time - much more versatile than the IDE's built in log viewer.
It won't work for me now - that's on 64 bit Windows 8.

I ran the Windows 8 troubleshooter wizard and it suggested i run the log viewer in Windows XP compatibilty mode - which it applied to the log viewer .exe file.
Now the log viewer worked.
Next i exited the Windows 8 troubleshooter, it said cannot apply Windows XP compatibility settings and removed any setting it had just a minute ago applied to the log viewer exe file.

The log viewer no longer worked.

Seems as though Windows 8 has no Windows XP compatibility mode - Microsoft at long last removing any support for XP.
So why did the troubleshooter suggest XP compatibility mode and apply that mode - then when finishing the wizard say XP compatibility not available?

Be handy if agraham code update the log viewer to work with Windows 8.

Martin.
 

GMan

Well-Known Member
Licensed User
Longtime User
that's on 64 bit Windows 8
OK, i am using 64bit, too - but on VISTA

XP-Compatibilty mode also does not work.
Funny: i tested Windows NT4 Server Mode, and after starting a MsgBox came up:
javaerror1.jpg


Under this path IS no javaw.exe and i see, that i have also an folder .....\monitor-x86_64 (but also there is no fodler with javaw.exe)
So this should be the reason ... lets see what agraham has to say about this :rolleyes:
 
Last edited:

warwound

Expert
Licensed User
Longtime User
I had a problem with the log viewer on 64 bit Windows 7 Pro before i upgraded to 64 bit Windows 8 Pro.
It'd sometimes work and sometimes not.

With Windows 8 Pro it never works.
I used to have an OEM version of 64 bit Windows 8 on the laptop before 64 bit Windows 8 Pro and the log viewer worked with the OEM Windows.

Martin.
 

warwound

Expert
Licensed User
Longtime User
I´m using Windows 7. Seems we have to wait for a new version of the logviewer :)

Try right clicking the log viewer exe file and choosing Properties > Compatibility.
You should see Windows XP (SP3) compatibility mode available.
Can you select that mode and apply it then try the log viewer again?
Does it now work?

Martin.
 

GMan

Well-Known Member
Licensed User
Longtime User
SOLVED - i just found 2 javaw.exe - one in the Arduino Developer Folder and one under \Windows\SysWOW64

So i created under the \monitor-x86 the folders jre and bin and copied the javaw.exe from the Windows-Dir to that point.

:D:);)

Hmmm...but still get no input....
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Try right clicking the log viewer exe file and choosing Properties > Compatibility.
You should see Windows XP (SP3) compatibility mode available.
Can you select that mode and apply it then try the log viewer again?
Does it now work?

No. Still get the message "Das System kann die angegebene Datei nicht finden" after i click on START. Device is connected to PC with USB and drivers are uptodate.

The androids monitor works fine. I think i use the monitor if the B4A-intern log-viewer is not comfortable enough for me... Happens when i have a lot to look into the logs while coding.
 

GMan

Well-Known Member
Licensed User
Longtime User
Awesome - try to start the Monitor.exe in the \monitor-x86 folder
 

DonManfred

Expert
Licensed User
Longtime User
That´s the program which opens here when i start the monotor.bat...

But the ViewServer does not work. Samsung has change the kernel too much. A solution would be to use this java-lib
inside an app... Maybe someone can make a wrapper for this java-lib so we could include it in a B4A-App which then can be monitored through the viewserver (monitor)... Would be a GREAT ADDITION to b4A! And also a great step forward for developers. :D
 

GMan

Well-Known Member
Licensed User
Longtime User
Yes, that would be helpful - the normal Log would also enough for me, but...
 

GMan

Well-Known Member
Licensed User
Longtime User
AWESOME

i got an additional SAMSUNG Galaxy S2 - connected with that device all log-entries are displayed, also all other log-functions works.

When i connect it with my Samsung S4 clone (rooted), it didnt work (again).
So: is it a device depending or 'cause the phone is rooted ?

Here is the code (sample by DonManfred) which shows this:
B4X:
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.

    Dim lv As ListView
    Private EditText1 As EditText
    Private Button1 As Button
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("main")
    lv.Clear
 
    For i = 0 To 2
        Dim retmap As Map
        retmap.Initialize
        retmap.Put("tag","TagValue"&i)
        retmap.Put("itemID","ItemID"&i)
        retmap.Put("name","ItemName"&i)
        retmap.Put("line1","This is line 1")
        retmap.Put("line2","This is line 2")
        lv.AddTwoLines2(retmap.Get("line1"), retmap.Get("line2"), retmap)
    Next
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub lv_ItemClick (Position As Int, Value As Object)
    Dim retmap As Map
    retmap = Value
    Log("Item at Pos "&Position&" Clicked...")
    Log("ItemInfos:")
    Log("tag = "&retmap.Get("tag"))
    Log("itemID = "&retmap.Get("itemID"))
    Log("name = "&retmap.Get("name"))
    Log("line 1 = "&retmap.Get("line1"))
    Log("line 2 = "&retmap.Get("line2"))
End Sub
Sub Button1_Click
    Dim retmap As Map
    retmap.Initialize
    retmap.Put("tag","TagValue")
    retmap.Put("itemID","ItemID")
    retmap.Put("name","ItemName")
    retmap.Put("line1",EditText1.Text)
    retmap.Put("line2","This is line 2")
    lv.AddTwoLines2(retmap.Get("line1"), retmap.Get("line2"), retmap)
End Sub
 

Attachments

  • listviewtest.zip
    7.5 KB · Views: 265

DonManfred

Expert
Licensed User
Longtime User
I dont need to test it. It will work here (i wrote the snippet :))
And it works on all other devices in our company.

I have had an Samsung Galaxy Note 1 and it worked. Now i have a Samsung Galaxy Note 3 and it works too (un-rooted)
Last week i rooted my Note 3 and it works like before. I can see all logs from running b4a-apps who have LOG-commands compiled.
I have tested it with some other devices in our company too. S2,3,4, HTC ONE, Samsung Tablet...

The point is that i always need to have actual USB-drivers for the devices to get them working with B4A or respectively with Googles ADB...

See http://snapshots.basic4android.de/Listview-log.wmv
 
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
As i wrote: Awesome

Drivers of course are all actual (so far) - cheked them again, all actual.
with a rootet 7" Tablet (Android 2.1) it also works.
But with the S4 only this message appears when connecting the Log:
LogCat connected to: B4A-Bridge: alps GT-I9502-355201261821479

ALL other Apps, Software etc. works with FTP, BT etc. , cross-platform and cross-x

And as warwound wrote:
It'd sometimes work and sometimes not.
 
Top