Debugging Android build

692 views
Skip to first unread message

Rahul

unread,
Apr 29, 2014, 10:02:37 AM4/29/14
to chromi...@chromium.org
HI,
I am building Chromium for Android. I want to do some experiments with the build writing log statements, How can I do this?

Primiano Tucci

unread,
Apr 29, 2014, 1:34:20 PM4/29/14
to sharma.r...@gmail.com, Chromium-dev
If you're inside chromium, the ususal LOG statemens should be routed to Android log as well with the "chromium" tag, e.g.,
LOG(ERROR) << "Message." ;
 
If, for any weird reasons, you don't have base::Logging, the way you do low-level logging on Android (assuming you're talking of native C/C++ code is):

#include <android/log.h>
...
__android_log_print(ANDROID_LOG_ERROR, "RandomTagName", "There are %d books on the table", number_of_books);


On Tue, Apr 29, 2014 at 3:02 PM, Rahul <sharma.r...@gmail.com> wrote:
HI,
I am building Chromium for Android. I want to do some experiments with the build writing log statements, How can I do this?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Rahul

unread,
Apr 30, 2014, 1:51:58 AM4/30/14
to chromi...@chromium.org, sharma.r...@gmail.com
@Primiano:  Thanks for the reply. But how would be able I see the result of log statements as I am transferring the .apk file to the Android device. For windows build it used to work with "chrome.exe --enable-logging -v=1" as the browser application was on the same machine.

Mikhail Naganov

unread,
Apr 30, 2014, 3:47:31 AM4/30/14
to sharma.r...@gmail.com, Chromium-dev
Chrome log on Android goes into the system log. Just use what you usually use for viewing log output on Android, e.g. "adb logcat".

Primiano Tucci

unread,
Apr 30, 2014, 6:11:09 AM4/30/14
to Mikhail Naganov, Rahul Sharma, Chromium-dev

Ah, sorry, I assumed you were familiar with Android logging, my bad. 
The way you see logs on Android is by running :

adb logcat 
adb is regularly part of the Android sdk. There should be a copy checked inside the chromium tree at this location:

$CHROME_SRC/third_party/android_tools/sdk/platform-tools/adb

Note that the log is going to be pretty spammy. If you want to see only errors, you can do:

adb logcat *:E

Or eventually to filter only chrome logging entries

adb logcat | grep chromium  

(IIRC all the LOG commands in chrome should be translated into __android_log_print commands which have tag="chromium")

Rahul Sharma

unread,
Apr 30, 2014, 6:28:04 AM4/30/14
to chromi...@chromium.org, Mikhail Naganov, Rahul Sharma
Thanks Primiano and Mikhail.

Igor Yanishevskiy

unread,
Feb 21, 2016, 12:04:59 PM2/21/16
to Chromium-dev, sharma.r...@gmail.com
I'm also trying to use logging, and when I'm using LOG(ERROR) or LOG(INFO), I just don't see any logging in logcat.
And when I'm trying with __android_log_print, I'm getting error: undefined reference to '__android_log_print' on linking step.

вторник, 29 апреля 2014 г., 19:34:20 UTC+2 пользователь Primiano Tucci написал:
Reply all
Reply to author
Forward
0 new messages