IDE Error when opening second project.
Steps to Reproduce
All projects I talk are Flutter projects.
On Android Studio with one or more projects open:
- Run the Flutter app. Wait for it to finish
- Go to File -> open recents -> select a project. Select to open in New Window.
Expected to happen: New project opens in a new window.
What actually happens: The project doesn't open and it disappears from open recents section. If I close and open Android Studio, the project opens. If no app is running, everything opens correctly.
Version info
Android Studio 3.2 • Flutter plugin io.flutter 28.0.2 • Dart plugin 181.5616
Flutter 0.9.4 • channel dev • https://github.com/flutter/flutter.git Framework • revision f37c235c32 (6 days ago) • 2018-09-25 17:45:40 -0400 Engine • revision 74625aed32 Tools • Dart 2.1.0-dev.5.0.flutter-a2eb050044
Exception
java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
java.util.concurrent.CompletionException: java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:593)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at io.flutter.run.daemon.DaemonApi$Command.completeExceptionally(DaemonApi.java:375)
at io.flutter.run.daemon.DaemonApi.dispatch(DaemonApi.java:181)
at io.flutter.run.daemon.DaemonApi$1.onTextAvailable(DaemonApi.java:141)
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.execution.process.ProcessHandler$5.invoke(ProcessHandler.java:223)
at com.sun.proxy.$Proxy17.onTextAvailable(Unknown Source)
at com.intellij.execution.process.ProcessHandler.notifyTextAvailable(ProcessHandler.java:197)
at com.intellij.execution.process.BaseOSProcessHandler$SimpleOutputReader.onTextAvailable(BaseOSProcessHandler.java:198)
at com.intellij.util.io.BaseOutputReader.sendText(BaseOutputReader.java:202)
at com.intellij.util.io.BaseOutputReader.processInput(BaseOutputReader.java:186)
at com.intellij.util.io.BaseOutputReader.readAvailableNonBlocking(BaseOutputReader.java:105)
at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:85)
at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:163)
at com.intellij.util.io.BaseDataReader$1$1.run(BaseDataReader.java:66)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:209)
at com.intellij.util.io.BaseDataReader$1.run(BaseDataReader.java:63)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error from app.callServiceExtension: "Bad state: No element"
... 22 more
I can't reproduce this. Couple questions:
What do you mean by "Run the Flutter app. Wait for it to finish"? Do you run the app and wait for it to build and launch? Or do you make it stop running on the device?
Do you see the same problem if you use "Open" and navigate to a project directory, instead of selecting something from "Open Recent"?
Does the problem occur with a more recent Flutter release? The dev channel is on 0.9.5 and the plugin was updated to M29 this week.
The root cause of this problem is an error thrown by the Dart code in the flutter tool. Without more information there isn't much we can do. See #2657 for more detail.
After flutter upgrade I couldn't reproduce the error anymore. I think the problem is now fixed :)
Great to hear. Thanks for following up @MarcoAltranDC!