gpt4 book ai didi

android - 如何在 Android 上查看调试消息?

转载 作者:行者123 更新时间:2023-11-30 05:07:26 55 4
gpt4 key购买 nike

我有一个 Android 应用程序运行起来非常不稳定,我想修复它。所以我用 apktool 反编译了 apk,发现应用程序调用了一堆 Log.d,它在其中写入了有用的信息。然后我为 Android 安装了一个日志查看器,并认为它没有显示任何内容。我阅读了 CatLog 的评论(例如),用户告诉我它不适用于最新的 Android 版本。那么,现在我想知道该怎么做 - 如果我的手机没有 root,现在我可以在 Android 上查看日志跟踪吗?

编辑:我想知道是否有一些方法可以修改 apktool 反编译的 *.smali 文件中 Log.d 或 Log.e 的每次调用,这样我就可以将 say 写入文本直接文件 w/o 与操作系统的日志机制交互。有没有人做过类似的事情?我也知道使用远程调试会好得多,但我现在无法访问计算机 - 只能通过 SSH 访问智能手机和 Linux 服务器。

编辑 2:这是应用程序的 list 。我想弄清楚是否可以在其中添加可调试标志。

<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:targetSdkVersion="16" package="com.anda.otgdiskpro" platformBuildVersionCode="23" platformBuildVersionName="6.0-2704002">
<uses-feature android:name="android.hardware.usb.accessory"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:largeHeap="true">
<activity android:configChanges="orientation" android:label="@string/app_name" android:launchMode="singleInstance" android:name="com.anda.otgdiskpro.USBActivityPro">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:label="Settings" android:name="com.anda.otgdisk.PrefPage"/>
<activity android:configChanges="orientation" android:label="@string/title_activity_music" android:launchMode="singleInstance" android:name="com.anda.otgdisk.MusicActivity"/>
</application>
</manifest>

编辑 3:啊哈!显然我必须把 "android:debuggable="true""I 放到 AndroidManifest.xml 的应用程序标签中...好的。我修改了 AndroidManifest.xml:

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:largeHeap="true" android:debuggable="true">

将其编译为 apk,签名并安装在智能手机上。我还安装了 LogCat Extreme。运行这两个应用程序并且... LogCat Extreme 中没有日志。 Android 似乎不允许我查看其他应用程序的日志。对吧?

最佳答案

您的应用需要在构建变体中定义debuggable true,以便您查看Log 消息。

查看此 documentation .

在应用程序中启用调试后,您可以使用 Logcat通过其包名称查看您的应用程序的日志。我从未使用过 CatLog,但我认为它只是解析 Logcat 以显示日志。

关于android - 如何在 Android 上查看调试消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54334001/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com