-
Notifications
You must be signed in to change notification settings - Fork 330
Fix Android Studio 2025.2 project open hang by using StartupActivity (projects with missing .idea directories) #8710
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
Conversation
pq
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.
Cool!
Do you have any insight into what was causing the hangs w/ the Kotlin-migrated code? Was it anything we could have noticed in a code review? (Do you recall if you used the IntelliJ tooling for the conversion BTW or was that Gemini?)
| // Instead, we let the Platform open the project normally, and then apply our configuration here. | ||
| // This includes ensuring the module type is set to 'flutter' (for icons/facets) and enabling the Dart SDK. | ||
| // See https://github.com/flutter/flutter-intellij/issues/8661 | ||
| for (com.intellij.openapi.module.Module module : FlutterModuleUtils.getModules(project)) { |
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.
Could you remove this qualified name by adding an import for com.intellij.openapi.module? (That seems generally preferred -- Gemini will confirm -- and is consistent with the rest of our codebase.)
Unless there's a conflict?
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.
Could you update your prompt to do this in general?
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.
I didn't use the "finalize this code before review" prompt, but I should have. Yes, this is something we should add to the prompts.md file.
| } | ||
|
|
||
| // Ensure Flutter project configuration is applied. | ||
| // This logic was previously in FlutterStudioProjectOpenProcessor. However, that processor |
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.
This comment is great. Thanks!
|
Thinking ahead to automated, if not just manual testing, could you consider adding some notes about how this fix was verified and how we can be sure removing Thanks! |
| for (com.intellij.openapi.module.Module module : FlutterModuleUtils.getModules(project)) { | ||
| if (FlutterModuleUtils.declaresFlutter(module) && !FlutterModuleUtils.isFlutterModule(module)) { | ||
| ApplicationManager.getApplication().invokeLater(() -> { | ||
| ApplicationManager.getApplication().runWriteAction(() -> { |
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.
Consider adding logging here?
And maybe a note to add analytics when we have them?
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.
done
Updating the commit message. |
…(projects with missing .idea directories) The custom `FlutterStudioProjectOpenProcessor` was causing hangs and crashes due to threading issues when delegating to the Platform's project opener in newer Android Studio versions. This change: - Removes `FlutterStudioProjectOpenProcessor` entirely, allowing the robust standard Platform processor to handle project opening. - Moves the necessary Flutter configuration (setting module type, enabling Dart SDK) to FlutterStudioStartupActivity, ensuring it runs safely after startup. Fixes flutter#8661
The custom
FlutterStudioProjectOpenProcessorwas causing hangs and crashes due to threading issues when delegating to the Platform's project opener in newer Android Studio versions.This change:
FlutterStudioProjectOpenProcessorentirely, allowing the robust standard Platform processor to handle project opening.Fixes #8661
This issue was identified by having the open project dialog not work on a valid flutter project, without a
.ideadirectory:flutter create flutter_no_idea && cd flutter_no_idea && rm -rf .ideaFlutter and Android Studio versions: