Android 开发部分基础工具使用

本文详细介绍了NDK调试中的符号路径设置、strip选项调整、添加-g参数以获取调试信息,以及如何在遇到SIGILL问题时使用LLDB进行处理。此外,还提到了perfetto和sysTrace新工具,以及反编译工具jadx-gui和AndroidStudio的UiautomatorViewer的使用方法。
摘要由CSDN通过智能技术生成
c++调试

在NDK调试的时候,如果找不到 符号的话,我们可以在调试配置中添加符号地址的全路径一直到根目录:,xxx/armeabi-v7a:
You must point the symbol search paths at the obj/local/ directory. This is also not a recursive search path, so you must set the full path to the obj/local/armeabi-v7a directory.
在这里插入图片描述

NDK调试的过程中,如果debug包也是将so strip的话,可以在build选项中控制不strip

buildTypes {
    debug {
        packagingOptions {
            doNotStrip '**/*.so'
        }
    }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        packagingOptions {
            doNotStrip '**/*.so'
        }
    }
}

如果通过上面的方式 don’t strip 还是无法调试,可以尝试 增加 -g 参数,增加调试信息。

android {
	... 
    buildTypes {
    	debug {
    		externalNativeBuild {
            	cmake {
            		// 生成调试信息
                	cppFlags += "-g"
               	}
        	}	
    	}
    }

报错解决:
如果在NDK debug 调试的时候有下面的报错:

If you experience an application crash at AInputQueue_preDispatchEvent with SIGILL (illegal instruction), there is a workaround available by disabling the SIGILL handler in LLDB. Follow these instructions to do so:

我们可以使用下面的方式去解决:

1. Open the application in Android Studio.
2. Open Run > Edit Configurations.
3. On the Run/Debug Configurations window, make sure your app is selected in the left pane, and click the Debugger tab in the right pane.
On the Debugger tab, click the LLDB Post Attach Commands tab below.
4. Click the + to the right, add the following command, and press Enter:
    process handle --pass true --stop false --notify true SIGILL
5. Click OK to apply the change.
perfetto

新的sysTrace工具
https://developer.android.com/studio/command-line/perfetto?hl=zh-cn

反编译工具:

jadx-gui:
方便的jadx工具,可以直接反编译apk
与jd-gui有类似的界面
支持全局搜索

Mapping 设置

打开 Settings 按照下面的方式添加自己的工程路径到项目中,这样我们就可以将项目添加到Android studio 的git 管理工,在代码编辑的地方直接右键 Annotate 可以看到代码提交记录
在这里插入图片描述

Android 布局查看和分析 uiautomatorviewer 位置
uiautomatorviewer : “UIautomatorviewer” is a GUI tool to scan and analyze the UI components of an Android application
使用 该工具可以去分析布局的层级和结构,mac中ui autoviewer的位置 android-sdk→tools→bin→uiautomatorviewer.bat

使用 Android Studio Dump 线程的信息
在这里插入图片描述

使用 chrome 调试应用中的 web 程序

chrome://inspect/#devices
需要 debug 环境中调试。如果 Web 容器有 Debug 开关的话需要在对应的代码中打开

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值