如何在 Android 设备上创建和读取登录? [英] How to create and read Log on Android devices?

查看:44
本文介绍了如何在 Android 设备上创建和读取登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Android 上试用了我的应用,但突然无法正常运行(在 Windows 上运行正常).当我在 Android 上运行设备时,有没有办法查看统一控制台的错误和 Debug.Log 消息?(我使用开发模式和脚本调试).

我连接了adb到设备上,也可以用logcat和filter来unity",但是还是显示了一个疯狂的日志.

我只想看到一个干净的日志,显示错误和我的 Debug.Log 消息,我通常可以在 Windows 上的 Unity 上的 Unity 控制台上轻松清晰地看到这些消息.

解决方案

在 Android 上查看日志:

要查看

<小时>

如果您遇到设备日志未显示的问题,请从命令行重新启动 adb.exe..

停下来:

adb kill-server

然后重新开始:

adb start-server

<块引用>

我只想看到一个干净的日志,显示错误和我的 Debug.Log我通常可以在 Unity 控制台上轻松清晰地看到的消息在 Windows 上的 Unity.

1.首先使用 Unity 标签对其进行过滤.

2.从 Unity 构建设置禁用开发模式.启用此功能后,您将收到甚至不需要的额外日志.

在没有 Android Studio 的情况下在 Android 上查看日志:

您可以在没有 Android Studio 的情况下使用

<小时>

从 Android Java 插件打印日志:

如果您尝试从 Java 插件创建日志,而不是使用 Debug.Log 函数,使用Log 来自 Java 端的函数.

例如,Log.vLog.iLog.e.

从 Android C++ 插件打印日志:

如果使用 C++ 插件,请参阅我的另一个问题中的 this 插件,让我们您可以使用 Debug::Log 从 C++ 插件打印日志.

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.

解决方案

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:


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.

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.


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.

这篇关于如何在 Android 设备上创建和读取登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆