Open gspencergoog opened 4 years ago
Hmm, I'm not sure what's going on here.
Can you set the Dart sdk from the Dart settings page? Under the good, the Flutter settings page just sets the dart sdk to the one in
Have you tried File > Invalidate Caches / Restart
? That can often address strange IntelliJ issues.
What do you see in the project's .idea/libraries/Dart_SDK.xml file?
Invalidating the cache and restarted helped, at least for a few days.
I'm seeing the problem again now, though. The Dart SDK appears to be set correctly in the Dart plugin settings. It says support is enabled, and the SDK path is /Users/gspencer/code/flutter/bin/cache/dart-sdk
, which is correct. The SDK path in the Flutter plugin is blank, and while I can set it, pressing Apply or OK clears it again (as before).
I've archived my .idea
directory for you if you want it. Are there any other caches/locations I should preserve for debugging?
The Dart_SDK.xml
file contains this, which all looks pretty normal to me.
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/async" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/cli" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/collection" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/convert" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/core" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/developer" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/ffi" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/html" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/io" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/isolate" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/js" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/js_util" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/math" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/svg" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/wasm" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/web_gl" />
<root url="file://$PROJECT_DIR$/bin/cache/dart-sdk/lib/web_sql" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
Interesting. It's possible that we don't think that the sdk you're entering in is a valid Flutter sdk. Is there anything unique about the sdk you're using?
I'm guessing that you're working on code in the flutter repo itself, and the sdk path is effectively relative to the project you're working on (that's a supported use case, I just want to confirm)?
Yes, that's how it is configured. The SDK isn't anything special, it's the one downloaded by the Flutter tool.
About the only thing I can think of is that I do have my cache directory symlinked (so bin/cache
is a symlink to bin/cache.master
in that same directory). This is so I can avoid downloading another Gig of data each time I switch to stable/dev and back to master.
I was going to try quitting IntelliJ, switching to a non-symlinked cache dir, and starting again, but I simply restarted (without invalidating the IntelliJ cache, or changing the symlink), and the problem went away: the Flutter plugin now shows the right SDK setting.
So, it's possible that having my Flutter cache dir symlinked could cause some issues, but I don't think I moved the symlink around while IntelliJ was running, and it should follow links, right?
OK, I've removed the symlink (just installed entirely separate flutter SDKs for stable, beta, and dev), and restarted IntelliJ again, and I'll keep a watch out for it happening again.
I suspect it was the symlink - that we couldn't validate the flutter sdk because we didn't see the dart sdk.
We should likely either relax the validation or handle symlinks (assuming that was the issue).
OK, I just had this happen again, and this time I don't have any symlinks at all. Identical symptoms. I tarred up my entire Flutter repo if you want it.
This time it started happening just after a "Clear cache and restart".
Some notes of things Devon and I tried while debugging this. 1) I sent him the .idea directory from my project. 2) I sent him the idea.log file.
He found the following stack trace in it, leading him to think that the problem could be my settings repository auto-sync changing the settings under the plugin.
java.lang.InterruptedException
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:78)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at org.jetbrains.settingsRepository.AutoSyncManager$autoSync$3.run(autoSync.kt:102)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:255)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
I turned off auto-sync, and restarted and cleared the cache, and I'm back to the non-broken state again, but that has happened before.
I'm going to keep using it and if it breaks again, we'll take another look.
@gspencergoog Did you set a custom location in File > Settings Repository...
:
I'm just looking for a repro case.
Yes, it's set to my private settings repository (I skip around between machines a lot, and I need to have it synced on multiple machines to stay sane).
Steps to Reproduce
When I open the Flutter framework to work on it, the "No Flutter SDK Configured" banner keeps reappearing.
1) Open the Flutter framework in the IDE 2) see the "No Flutter SDK Configured" banner at the top of a Dart file. 3) Click on "Open Flutter Settings" 4) Select your flutter directory. 5) Wait until the version information populates. Mine says:
6) Click "Apply" 7) Notice that the selected flutter SDK field blanks out again 8) Select the flutter directory again 5) Wait until the version information populates again. 9) Click "OK". 10) Notice that: a) The banner didn't go away b) When I reopen the settings page, the SDK path is blank again. c) Even if I click "dismiss", closing the tab and reopening that file brings back the banner.
Version info
I also do have IntelliJ installed, just not in a standard location that flutter doctor can find it in. I'm running IntelliJ CE 2020.1, with the 46.0.3-dev.3 version of the Flutter plugin.