【发布时间】:2019-01-23 19:00:48
【问题描述】:
我有一个运行非常不稳定的 Android 应用,我想修复它。所以我用 apktool 反编译了 apk,发现应用程序调用了一堆 Log.d,它在其中写入了有用的信息。然后我为 Android 安装了一个日志查看器,并认为它没有显示任何内容。我阅读了 CatLog 的评论(例如),用户告诉它在最新的 Android 版本上不起作用。好吧,现在我想知道该怎么做 - 如果我的手机没有 root,我现在可以在 Android 上查看日志跟踪吗?
编辑:我想知道是否有某种方法可以修改由 apktool 反编译的 *.smali 文件中的 Log.d 或 Log.e 的每个调用,这样我就可以写到文本中文件直接不与操作系统的日志机制交互。有没有人做过类似的事情? 我也明白使用远程调试会好得多,但我现在根本无法访问计算机 - 只能通过 SSH 访问智能手机和 Linux 服务器。
编辑 2:这是一个应用的清单。我想弄清楚是否可以在其中添加可调试标志。
<?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"”我放到 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不允许我查看其他应用程序的日志。对吧?
【问题讨论】: