-
Notifications
You must be signed in to change notification settings - Fork 0
[Chore] 웹 뷰 안정성 추가 #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Chore] 웹 뷰 안정성 추가 #399
Conversation
Summary of ChangesHello @HI-JIN2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 웹뷰 사용 시 발생할 수 있는 렌더러 충돌로 인한 앱 강제 종료를 방지하고, 웹뷰 관련 자원을 보다 안정적으로 관리하기 위한 변경사항을 포함합니다. 특히 Android 8.0 이상 환경에서 웹뷰의 안정성을 향상시키고, 액티비티 생명주기에 맞춰 웹뷰 자원을 적절히 해제하여 전반적인 앱의 견고함을 높이는 데 중점을 둡니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds stability improvements to the WebView component to prevent app crashes when the WebView renderer process crashes. The changes implement crash handling and proper cleanup mechanisms.
- Adds
onRenderProcessGonecallback to handle WebView renderer crashes gracefully - Implements proper WebView cleanup in
onDestroyto prevent memory leaks - Adds logging for debugging WebView crashes
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| // WebView를 재생성하거나 오류 안내 UI를 표시 | ||
| recreate() // Activity 재시작으로 복구 |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling recreate() in onRenderProcessGone may cause infinite crash loops if the WebView consistently fails to render. Consider implementing a retry counter or showing an error message instead of automatically recreating the activity.
| override fun onDestroy() { | ||
| binding.webview.apply { | ||
| stopLoading() | ||
| webChromeClient = null |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webChromeClient is being set to null but it was never explicitly set in this code. If it's set elsewhere, consider also setting webViewClient = null for consistency and complete cleanup.
| webChromeClient = null | |
| webChromeClient = null | |
| webViewClient = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
안녕하세요. 웹뷰 안정성 개선을 위한 변경 사항 잘 보았습니다. 렌더러 충돌 시 앱이 강제 종료되는 것을 방지하기 위해 onRenderProcessGone 콜백을 구현하고, 액티비티 종료 시 WebView 리소스를 정리하여 메모리 누수를 방지하는 로직을 추가해주셨네요. 전반적으로 좋은 방향의 개선입니다.
다만, 몇 가지 추가 개선 사항을 제안드립니다. 렌더러 충돌이 반복될 경우 액티비티가 무한 재시작될 수 있는 가능성과, onDestroy에서 WebViewClient 참조를 해제하여 메모리 누수를 더 확실하게 방지하는 방법에 대해 의견을 남겼습니다. 확인 부탁드립니다.
| } | ||
|
|
||
| // WebView를 재생성하거나 오류 안내 UI를 표시 | ||
| recreate() // Activity 재시작으로 복구 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| binding.webview.apply { | ||
| stopLoading() | ||
| webChromeClient = null | ||
| destroy() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메모리 누수를 방지하기 위해 onDestroy에서 WebView 리소스를 해제하는 것은 매우 좋은 방법입니다. webChromeClient를 null로 설정하는 것과 마찬가지로, onCreate에서 설정한 webViewClient도 null로 설정하여 액티비티에 대한 참조를 안전하게 제거하는 것이 좋습니다. 이렇게 하면 익명 클래스로 생성된 WebViewClient가 액티비티의 컨텍스트를 계속 붙잡고 있는 것을 방지할 수 있습니다.
| binding.webview.apply { | |
| stopLoading() | |
| webChromeClient = null | |
| destroy() | |
| } | |
| binding.webview.apply { | |
| stopLoading() | |
| webViewClient = null | |
| webChromeClient = null | |
| destroy() | |
| } |
PeraSite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop 브랜치로 돌려서 해봐도 문제 없는 걸 보니 그 때 당시만 제 기기에 문제가 있었나봐요..?!
안정성을 올렸다에 의의를 두면 될 것 같습니다 허허.. 고생하셨어요!!
kangyuri1114
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Summary
웹뷰 충돌 안정성을 추가 했습니다.
다만, 저는 이전 코드에서 아무리 빠르게 해봐도 앱이 강제 종료된 적이 없어서 ..
@PeraSite 님께서 풀 받아서 테스트 해주셔야 약효가 있는 코드인지 확인이 가능할 것 같습니다!
Issue