Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create and read Log on Android devices?

I just tried my app on Android and it suddenly doesn't work well (on Windows it works fine). Is there a way to see unity console's errors and Debug.Log messages- when I run the device on Android?(I use development mode and script Debugging).

I connected adb to the device, and can also use logcat and filter to "unity", but it still shows a crazy log.

All I want to see is a clean log that shows errors and my Debug.Log messages which I usually can see easy and clear on the Unity Console on Unity on Windows.

like image 899
SHAI Avatar asked Jun 22 '17 04:06

SHAI


People also ask

Is there an Android system Log?

Android allows collecting system logs using Logcat. Log messages can be viewed in a Logcat window in Android Studio, or you can use the command line tool to pull them. Several Android apps are also available in the Google Play store that allow easy access to these tools.

Where are the Log files in Android?

Open your file manager and navigate to the Android device. Browse to "<Android-device>\Internal storage\logback" directory.


2 Answers

View Logs on Android:

To see Debug.Log messages, download Android Studio. Go to the Android Monitor Tab in the Android Studio then select your device from there.

See the image below:

enter image description here


If you have problems of the logs from the device not showing, restart adb.exe. from the command-line.

Stop it:

adb kill-server

Then start it again:

adb start-server

All I want to see is a clean log that shows errors and my Debug.Log messages which I usually can see easy and clear on the Unity Console on Unity on Windows.

1.First filter it with the Unity tag.

enter image description here

2.Disable Development mode from Unity Build Settings. With that on, you will receive extra logs you don't even need.

View Logs on Android without Android Studio:

You can view log from without Android Studio by using the Log Viewer plugin which is free. It will let you see the log on the device itself.

enter image description here


Print Logs from Android Java Plugin:

If you are trying to create log from Java plugin, instead of using the Debug.Log function, use one of the Log functions from Java side.

For example, Log.v, Log.i, and Log.e.

Print Logs from Android C++ Plugin:

If using a C++ plugin, see this plugin from my other question which let's you print log from a C++ plugin with Debug::Log.

like image 77
Programmer Avatar answered Oct 09 '22 11:10

Programmer


With the new release of Unity 2019.1 you can download from the package manager the Android Logcat that allows you to display information inside the Unity editor.

Inside the Unity editor go to Window > Package Manager > Download and install the Android Logcat package.

For more information on a how to use guide you can visit this manual : https://docs.unity3d.com/Packages/[email protected]/manual/index.html

like image 44
Migko Avatar answered Oct 09 '22 11:10

Migko