-
Notifications
You must be signed in to change notification settings - Fork 75
Logcat
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:
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
- Go to Settings
- Look for Developer Options. If it exists continue from step 11
- Go to Applications
- Look for Development. If it exists continue from step 11
- Go to Settings > About
- Look for Build Number. If it exists go to step 9
- Go to Software Information > More
- Look for Build Number
- Tap it 7 times (in some devices, you may have to type your password)
- Go to Step 1
- Check USB Debugging
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 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
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.
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.