1.在build.gradle里面加上
implementation 'com.jaredrummler:android-shell:1.0.0'
2.增加个打印函数:
private void printThread() {
String cmd = "busybox ps -T "+android.os.Process.myPid()+"|grep "+getPackageName();
CommandResult result = Shell.SH.run(cmd);
if(result.isSuccessful()){
Log.d("","--print thread:"+cmd);
Log.d("","--print thread:"+result.getStdout());
}
}