Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The motivation of this PR is to pass native logs to Radon IDE. Currently, if the app crashes on the native side developer needs to open Android Studio anyway.
How it's done?
Radon IDE (Android Native Logs)
adb logcat
(without any params) in the subprocess to get the app PID (we don't pass the logs to IDE at this point)adb logcat
for the given PID with the history (-T
param), to get all logs since the process started, and pass them to IDEWhy like this?
We don't want to pass all
adb logcat
logs, as those are enormous. I didn't find a way to filter logs by packageId (except filtering them with regex), so the most reliable way seems to be to filter them by PID.Now, suppose the app crashes at the very beginning (for example, during
MainApplication.onCreate()
). In that case, we have no way of getting PID before (because the process is not created yet) and after (the process is already killed). To solve this case, for a short period of time, we go through all logs with regex to look for app start2024-11-15 14:51:24.154 574-606 ActivityManager system_server I Start proc 4474:com.reactnative76/u0a198 for next-top-activity {com.reactnative76/com.reactnative76.MainActivity}
and extract pid. Then we kill this process and spawn one that is properly filtered (with history, so the logs that came up during app start are there too).
Remarks:
channel.clear()
this seems to be VSCode issue: Do not show complete content after reload if output is cleared microsoft/vscode#204946How Has This Been Tested:
Normal
Radon IDE (Android Native Logs)
output to see the logsCrash on startup
throw IllegalStateException("This line should not be reached")
to MainApplication.onCreate()Radon IDE (Android Native Logs)
outputDemo:
Screen.Recording.2024-11-15.at.21.21.16.mov