Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
R8 retrace là một công cụ giúp lấy dấu vết ngăn xếp ban đầu từ dấu vết ngăn xếp đã làm rối mã nguồn. Dấu vết ngăn xếp được tạo lại bằng cách so khớp tên lớp và phương thức trong tệp ánh xạ với định nghĩa ban đầu.
Cách sử dụng
Để truy xuất dấu vết ngăn xếp đã làm rối mã nguồn, hãy chuyển tệp ánh xạ đến retrace:
Nếu không có tệp dấu vết ngăn xếp nào được cung cấp trên dòng lệnh, R8 retrace sẽ chờ người dùng nhập dấu vết ngăn xếp thông qua phương thức nhập chuẩn. Sau khi nhập, hãy kết thúc luồng đầu vào:
Linux, macOS: Control+D
Windows: Control+Z+Enter
Sau đó, đầu ra truy vết được nhập lại sẽ được ghi vào đầu ra tiêu chuẩn.
Tuỳ chọn
Bảng sau mô tả các tuỳ chọn dòng lệnh của R8 retrace:
Lựa chọn
Bắt buộc?
Mô tả
--verbose
không
In thêm thông tin, chẳng hạn như các tham số của phương thức và loại dữ liệu trả về của phương thức.
--info
không
Đặt mức chẩn đoán thành info. Để biết thêm thông tin chi tiết, hãy tham khảo DiagnosticsHandler.
--quiet
không
Giảm lượng thông tin được in để tập trung nhiều hơn.
--regex <regular_exp>
không
Ghi đè biểu thức chính quy mặc định để phân tích cú pháp các dòng dấu vết ngăn xếp.
Ví dụ: sau đây là một biểu thức chính quy có thể phân tích cú pháp các dấu vết ngăn xếp cơ bản:
(?:.*? at %c\.%m\(%s(?::%l)?\))|(?:(?:.*?[:"] +)?%c(?::.*)?).
Lưu ý về cách sử dụng
R8 retrace sử dụng một tệp ánh xạ đã tạo để ánh xạ tên lớp và phương thức bị làm rối mã nguồn về định nghĩa ban đầu. Để biết thêm thông tin về cách rút gọn ứng dụng để có thể truy xuất lại ứng dụng một cách chính xác, hãy xem phần Giải mã dấu vết ngăn xếp đã làm rối mã nguồn.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# R8 retrace is a tool for obtaining the original stack trace from an obfuscated\nstack trace. The stack trace is reconstructed by matching class and method names\nin a mapping file to their original definitions.\n| **Note:** R8 retrace is a standalone tool in version 4.0 of the command-line tools package, released with Android Studio 4.2.\n|\n| To download the command-line tools package with the SDK Manager, see\n| [Update your tools with the\n| SDK Manager](/studio/intro/update#sdk-manager). The SDK Manager installs R8 retrace in\n| `cmdline-tools/`\u003cvar translate=\"no\"\u003eversion\u003c/var\u003e`/bin/`.\n|\n| To download the command-line tools package using the command line, see\n| [`sdkmanager`](/studio/command-line/sdkmanager).\n\nUsage\n-----\n\nTo retrace an obfuscated stack trace, pass the mapping file to `retrace`: \n\n retrace \u003cvar translate=\"no\"\u003e path-to-mapping-file [path-to-stack-trace-file] [options] \u003c/var\u003e\n\nIf no stack trace file is given on the command line, R8 retrace waits for\nthe stack trace to be entered by the user through standard input. After input,\nterminate the input stream:\n\n- **Linux, macOS:** Control+D\n- **Windows:** Control+Z+Enter\n\nThe retraced output is then written to standard output.\n\nOptions\n-------\n\nThe following table describes the command-line options of R8 retrace:\n\n| Option | Required? | Description |\n|---------------------------------------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `--verbose` | no | Prints more information, such as method parameters and method return type. |\n| `--info` | no | Sets the diagnostic level to `info`. For a more in-depth look, refer to [DiagnosticsHandler](https://r8.googlesource.com/r8/+/refs/heads/main/src/main/java/com/android/tools/r8/DiagnosticsHandler.java). |\n| `--quiet` | no | Reduces the amount of information printed to increase focus. |\n| `--regex `\u003cvar translate=\"no\"\u003e<regular_exp>\u003c/var\u003e | no | Overwrites the default regular expression for parsing stack trace lines. For example, the following is a regex that can parse basic stack traces: `(?:.*? at %c\\.%m\\(%s(?::%l)?\\))|(?:(?:.*?[:\"] +)?%c(?::.*)?)`. |\n\nUsage notes\n-----------\n\nR8 retrace uses a generated mapping file for mapping obfuscated class and\nmethod names back to the original definition. For more information about\nshrinking your app so that it can be retraced correctly, see\n[Decode an obfuscated stack trace](/studio/build/shrink-code#decode-stack-trace)."]]