Skip to content

Commit 843363f

Browse files
committed
Fix Android Studio 2025.2 project open hang by using StartupActivity (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 #8661
1 parent e8d5fda commit 843363f

5 files changed

Lines changed: 19 additions & 155 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
### Fixed
1010

1111
- DtdUtils static field retaining disposed Project (#8658)
12+
- Fixed project open hang in Android Studio 2025.2 by removing legacy `FlutterStudioProjectOpenProcessor` and migrating configuration logic to `FlutterStudioStartupActivity`. (#8661)
1213

1314
## 88.2.0
1415

resources/META-INF/studio-contribs.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<extensions defaultExtensionNs="com.intellij">
1010
<externalSystemTaskNotificationListener implementation="io.flutter.utils.FlutterExternalSystemTaskNotificationListener"/>
1111
<postStartupActivity implementation="io.flutter.FlutterStudioStartupActivity"/>
12-
<projectOpenProcessor implementation="io.flutter.editor.FlutterStudioProjectOpenProcessor" order="after flutter"/>
1312
<library.type implementation="io.flutter.android.AndroidModuleLibraryType"/>
1413
<projectService serviceImplementation="io.flutter.android.AndroidModuleLibraryManager"/>
1514

src/io/flutter/FlutterStudioStartupActivity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.intellij.ide.projectView.ProjectView;
99
import com.intellij.ide.util.PropertiesComponent;
10+
import com.intellij.openapi.application.ApplicationManager;
1011
import com.intellij.openapi.application.ReadAction;
1112
import com.intellij.openapi.diagnostic.Logger;
1213
import com.intellij.openapi.project.Project;
@@ -22,6 +23,8 @@
2223
import io.flutter.utils.OpenApiUtils;
2324
import org.jetbrains.annotations.NotNull;
2425

26+
import java.util.Objects;
27+
2528
public class FlutterStudioStartupActivity extends FlutterProjectActivity {
2629
private static @NotNull Logger LOG = PluginLogger.createLogger(FlutterStudioStartupActivity.class);
2730
private static final String IS_FIRST_OPEN_KEY = "io.flutter.project.isFirstOpen";
@@ -58,6 +61,21 @@ public void executeProjectStartup(@NotNull Project project) {
5861
return;
5962
}
6063

64+
// Ensure Flutter project configuration is applied.
65+
// This logic was previously in FlutterStudioProjectOpenProcessor. However, that processor
66+
// caused hangs and crashes due to threading issues when delegating to the Platform processor (AS 2025.2).
67+
// Instead, we let the Platform open the project normally, and then apply our configuration here.
68+
// This includes ensuring the module type is set to 'flutter' (for icons/facets) and enabling the Dart SDK.
69+
// See https://github.com/flutter/flutter-intellij/issues/8661
70+
for (com.intellij.openapi.module.Module module : FlutterModuleUtils.getModules(project)) {
71+
if (FlutterModuleUtils.declaresFlutter(module) && !FlutterModuleUtils.isFlutterModule(module)) {
72+
Objects.requireNonNull(ApplicationManager.getApplication()).runWriteAction(() -> {
73+
FlutterModuleUtils.setFlutterModuleType(module);
74+
});
75+
FlutterModuleUtils.enableDartSDK(module);
76+
}
77+
}
78+
6179
// Set project tool window to show the project on first open (Android Studio sometimes opens android view instead).
6280
// See https://github.com/flutter/flutter-intellij/issues/8556.
6381
// Note: After showing the project view, subsequent opens should go to the project view also. However, if the android subdirectory is

src/io/flutter/editor/FlutterStudioProjectOpenProcessor.kt

Lines changed: 0 additions & 94 deletions
This file was deleted.

testSrc/unit/io/flutter/editor/FlutterStudioProjectOpenProcessorTest.kt

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)