Closed ScottPierce closed 7 years ago
if you rm -rf /Volumes/MacintoshHD/Users/spierce7/frameworks/flutter/bin/cache/artifacts/engine
does that fix it?
I did that and then ran from intellij again.
Downloading package sky_engine...
Running 'pub get' in sky_engine...
Downloading package sky_services...
Running 'pub get' in sky_services...
Downloading package flutter_services...
Running 'pub get' in flutter_services...
Building Dart SDK summary...
Downloading engine artifacts android-arm...
Downloading engine artifacts android-arm-profile...
Downloading engine artifacts android-arm-release...
Downloading engine artifacts android-x64...
Downloading engine artifacts android-x86...
Downloading engine artifacts ios...
Downloading engine artifacts ios-profile...
Downloading engine artifacts ios-release...
Downloading darwin-x64 tools...
Downloading android-arm-profile/darwin-x64 tools...
Downloading android-arm-release/darwin-x64 tools...
Starting device daemon...
Nothing happened after that for quite some time. I stopped the process and tried again, and received the same error.
@devoncarew: any ideas?
I suspect this is a flutter_tools or flutter infrastructure/packaging bug and has nothing to do with the intelliJ plugin. :) I don't know why a complete clearing of the artifacts cache and re-download didn't fix it, unless there is some sort of host/device architecture mismatch confusing flutter_tools where to find the file (this is an x86 Nexus 5x, so presumably an emulator, probably genymotion). But it also possible that when we built the artifacts for flutter/flutter@07f9998743 they were missing icudata.dat. Seems unlikely, but something we could check locally by pulling that revision and repeating his steps, or checking the flutter_infra bucket at that revision.
Thanks Eric! In that case, cc @danrubel 😄
In order to narrow down the problem, we can simulate how IJ uses flutter tools. Would you try the following and let me know what happens?
In a terminal window, type the following to get the id for your connected device:
$ /path/to/bin/flutter devices
Now launch the flutter daemon:
$ cd /your/flutter/app/directory
$ /path/to/bin/flutter daemon
Starting device daemon...
Then use the flutter daemon to launch your app in the same way that IJ launches the app.
The follow is typed in the terminal window after the Starting device daemon...
message:
[{"method":"app.start","id":2,"params":{"deviceId":"your-device-id-here","projectDirectory":"."}}]
@ScottPierce, I'm curious, when shell do you use on macos? This could be an issue where the path for processes launched from IntelliJ is not set up the same as that for apps run from the CLI.
When executing shell processes from Atom, we first sniff the user's PATH, and then execute processes using an env setting w/ that discovered PATH. We may need to do something similar here.
I use the normal terminal for osx, and intellij's terminal.
@danrubel I tried your instructions in the osx terminal, and intellij's terminal. Both worked fine.
@devoncarew in my .bash_profile
, after setting up my path, I also run the following, which gives intellij access to my path: launchctl setenv PATH $PATH
. I set this up several years ago, but before including this, intellij's terminal couldn't access variables in my path.
To be sure, I tried running from intellij again. The problem still exists.
My understanding from re-reading the above is that @ScottPierce has tried both the run button from within IntelliJ as well as flutter run
from the command line. They're both using the same flutter
path: /Volumes/MacintoshHD/Users/spierce7/frameworks/flutter/bin/flutter
and yet inside IntelliJ there is an error
Starting device daemon...
Cannot locate file: /Volumes/MacintoshHD/Users/spierce7/frameworks/flutter/bin/cache/artifacts/engine/android-x86-release/icudtl.dat
Failure building APK: unable to find components.
Where as the command line flutter run
works fine. That makes no sense?
This is likely the line which is failing: https://github.com/flutter/flutter/blob/fcfb2a5c559eeca6029a80624ceb01a10a84e929/packages/flutter_tools/lib/src/commands/build_apk.dart#L299
Maybe the enginePath is being set overridden on the command line via an evironment variable? My understanding is that that's possible:
https://github.com/flutter/flutter/blob/022cb2d9dc82b7fc06da3ee66d391d0407dad0d3/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart#L191
by setting FLUTTER_ENGINE
?
@danrubel: could you maybe take a look?
Based upon comments above, this seems like something with how IntelliJ is calling the flutter tools. Please reassign if you find something needs to be changed in flutter tools.
My guess is that we need to do some PATH detection and set up some environment variables when shelling out to flutter tools. I'll update the title in anticipation of that being correct :)
We do some similar SHELL wrangling in the atom plugin: https://github.com/dart-atom/atom.dart/blob/master/lib/node/process.dart#L201, which we may be able to crib off of.
Would comparing flutter doctor
output inside and outside intellij help resolve this bug? Is there a way for @ScottPierce to provide flutter doctor
output run inside IntelliJ?
Is there a way for @ScottPierce to provide flutter doctor output run inside IntelliJ?
Actually, there is. If you create a flutter project and look at the Messages view, there's a hyperlink:
Clicking that will put doctor output into the IDEA console.
I just updated to the latest plugin.
I ran flutter doctor as per the above instructions:
/Volumes/MacintoshHD/Users/spierce7/frameworks/flutter/bin/flutter --no-color doctor
[✓] Flutter (on Mac OS, channel master)
• Flutter at /Volumes/MacintoshHD/Users/spierce7/frameworks/flutter
• Framework revision 4b037fd65f (9 days ago), 2016-10-31 16:46:54
• Engine revision 63e71803de
• Tools Dart version 1.21.0-dev.2.0
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.0)
• Android SDK at /Volumes/MacintoshHD/Users/spierce7/Android/sdk
• Platform android-25, build-tools 25.0.0
• ANDROID_HOME = /Volumes/MacintoshHD/Users/spierce7/Android/sdk
• Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
[-] iOS toolchain - develop for iOS devices
x XCode not installed; this is necessary for iOS development.
Download at https://developer.apple.com/xcode/download/.
x ideviceinstaller not available; this is used to discover connected iOS devices.
Install via 'brew install ideviceinstaller'.
x ios-deploy not available; this is used to deploy to connected iOS devices.
Install via 'brew install ios-deploy'.
[-] Atom - a lightweight development environment for Flutter
• flutter plugin not installed; this adds Flutter specific functionality to Atom.
Install the plugin from Atom or run 'apm install flutter'.
• dartlang plugin not installed; this adds Dart specific functionality to Atom.
Install the plugin from Atom or run 'apm install dartlang'.
[✓] Connected devices
• Google Nexus 5X, 6 0 0, API 23, 1080x1920 • 192.168.56.101:5555 • android-x86 • Android 6.0 (API 23)
Issue still persists:
Starting device daemon...
Cannot locate file: /Volumes/MacintoshHD/Users/spierce7/frameworks/flutter/bin/cache/artifacts/engine/android-x86-release/icudtl.dat
Failure building APK: unable to find components.
+1. Seeing this issue as well when trying to use Android Emulators / Genymotion. Same output I believe:
Starting device daemon...
Cannot locate file: /Users/brian.egan/lab/flutter/bin/cache/artifacts/engine/android-x86-release/icudtl.dat
Failure building APK: unable to find components.
Maybe that's the issue. I am also trying to deploy to a Genymotion emulator.
@ScottPierce my recollection was you were having success from flutter run
at the command line, just not from within IntelliJ, correct?
@eseidelGoogle That's correct. flutter run
deploys no problem. It's just when I hit that green play button in intellij that the issue arrises.
Cannot locate file: /Users/brian.egan/lab/flutter/bin/cache/artifacts/engine/android-x86-release/icudtl.dat
isn't a valid path. The path should be bin/cache/artifacts/engine/android-x86/icudtl.dat
. There is no --release flavor of the non-arm binaries.
The build button in intellij produces a release build? Why's that?
It probably shouldn't. :) Release builds are most useful for deploying to the store (or demos).
Filed https://github.com/flutter/flutter/issues/6819 to track flutter run --release
having this bad behavior with genymotion. This issue can track any needed intelliJ changes.
Sounds like the PATH stuff was a boondoggle. The fixes are better tracked in flutter/flutter#6819, and will also change when we re-do the run button to run in --debug mode.
I can't run my build from intellij. Every time I press the play button I see this:
Running from command line with
flutter run
works just fine.I'm on the latest
alpha
, and I've also tried the latestmaster
branch with the same result.