Skip to content
Miku AuahDark edited this page Feb 14, 2020 · 1 revision

Logcat is a logging system that runs in all Android devices by default and catches the output of many applications, allowing users to catch problems and crashes.

Its a really useful tool since it can give the information needed to debug a crash in LÖVE but it can also be used to debug your game. Since the print function in Lua is connected to Logcat you can easily use this as a console to catch any errors or problems in your game and what causes them, without filling the game screen with all that information.

To use it just follow this steps:

Enable USB debugging

There are various ways of enabling the USB debugging, this depends on the version of Android, the device model and manufacturer. You can find lots of information about this on the internet. The following steps should work on any device running any version of Android

  1. Go to Settings
  2. Look for Developer Options. If it exists continue from step 11
  3. Go to Applications
  4. Look for Development. If it exists continue from step 11
  5. Go to Settings > About
  6. Look for Build Number. If it exists go to step 9
  7. Go to Software Information > More
  8. Look for Build Number
  9. Tap it 7 times (in some devices, you may have to type your password)
  10. Go to Step 1
  11. Check USB Debugging

Install ADB

If you already installed requirements for building LÖVE for Android, chance high that you already have ADB somewhere in your platform-tools folder.

You don't need all the Android SDK just for ADB. You can get ADB-only package in internet (XDA Developers forum are only trusted websites to get these things).

In Debian Buster (and possibly other distros), you can install ADB with sudo apt-get install adb.

Connect your device

USB Connection

Connect your device to your computer through USB. You don't need to use any special mode, "Charging" would do

If you are doing this with an OUYA you just need to enable the ADB Over Network option located under Manage > System > Development

Connect to your device

Open a terminal/command prompt and navigate to the SDK folder > platform-tools (if you have Android SDK platform-tools)

adb connect <Android Device-IP>

Then run adb devices, this should return a list with all the connected devices. If you have done everything right your device should appear in the list (Take note on the serial number for your device, it should be something like device-5554).

You can now start a remote shell, to do this there are two options.

If there are no other devices connected you can use:

adb -d shell

The other option is to use:

adb -s <serialNumber> shell

where <serialNumber> should be replaced with the serial that appeared in the device list before

From here on you could use any command listed in the ADB page to install applications, record the screen, etc.

Get the logcat output

To get the output you just need to run logcat -d inside of the remote shell you just opened.

For more logcat commands check the Logcat page

After this you can keep on sending commands to the remote shell or just send exit to kill it.