// Throws AssertionError if the input is false. public static void assertTrue(boolean cond) { getCaller(); Log.w(TAG, "assertTrue cond: "+cond); if (!cond) { throw new AssertionError(); } } public static String getCaller(){ int i; StackTraceElement stack[] = (new Throwable()).getStackTrace(); for (i=0; i < stack.length; i++) { StackTraceElement ste=stack[i]; Log.d(TAG,i+"--class:"+ste.getClassName()); Log.d(TAG,i+"--method:"+ste.getMethodName()); Log.d(TAG,i+"--FileName:"+ste.getFileName()); Log.d(TAG,i+"--LineNumber:"+ste.getLineNumber()); } return null; }
android 堆栈调试方法
最新推荐文章于 2022-05-20 15:38:58 发布