-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
"Dart_NewStringFromUTF8 expects argument 'str' to be valid UTF-8" #8612
Comments
@johnmccutchan I'm not sure where |
Yeah a bug report should have the info. @ajdewit1994 can you run |
bugreport_01.zip |
From a cursory look, it looks like it goes through the following process in attempting to find your Android SDK:
The quick fix may just be to put |
I also filed #8618 for fix this on the Flutter side. |
Thank you very much @tvolkert and @eseidelGoogle It works. I've prepended the android-sdk path to the PATH variable and I get the last remaining check. Good night! |
@ajdewit1994 in the morning, if you're so inclined, could you run without Thanks! |
Hello @tvolkert |
I've redownloaded flutter, ran |
The bug report will be written to your current directory, so try |
Here it is. |
Is this issue still active? I can't work with flutter anymore since the update where it's not possible anymore to run flutter with sudo. It's sort of blocking me now. |
@ajdewit1994 sorry - I'll have a look today (I got distracted by another issue). |
@ajdewit1994 it looks like the most recent bug report was still obtained while running as root. Can you do the following:
Thanks! |
Hi @tvolkert. I hope I don't get on your nerves, was just wondering if anything had happened. Unfortunately, it won't generate a bug report. Don't stress it, I commented the "sudo check" out in the flutter file which allows me to start using flutter. |
Ah the plot thickens! How about trying to run (not as root): p.s. not getting on my nerves at all! :-) |
Also: the terseness of that error message may be caused by #8742 |
@tvolkert can a recording help us here? |
See the last few comments - it's crashing before getting to write out a bug report, one possible reason for which would be a VM crash. I'm hoping a @rmacnak-google do you know if there's a flag to flutter tools we can pass to enable VM trace statements to be logged to stdout? |
Not stdout, but there's a VM flag |
The |
With no other output at all? Fascinating! Can you try going to the root of your flutter checkout and running the following? It will dump a LOT of output, if things go well. It may not dump much at all if they don't. It would be very useful to see what it does dump.
|
Uh, ok. I don't have the Results in the following |
It looks like you may have accidentally typed " Basically, the " Can you try sending it again? :-) |
Sorry for the late answer, I've been a bit busy lately. @tvolkert https://gist.github.com/ajdewit1994/067b233b0c5b05375e2b96d9ce1d97b3 @Hixie https://gist.github.com/ajdewit1994/b37e5c764c08ba7b1d7aa056fcee2086 |
What's the full path to your project directory? |
Just summarizing what I think we know at this point:
If all that I say above is correct, then here's where I propose we go from here:
Before we start talking solutions, does all sound about right? |
I don't understand how there could be a bin/cache directory as non-root but there is one as root. |
If the permissions/ownership on |
@ajdewit1994 Is your flutter clone when running as root in a different directory than the one when running as your main user, or are they the same directory? |
@tvolkert If I understand correctly, he's getting the UTF8 error even when he just runs "flutter doctor", which would be downloading Dart into bin/cache and using that, it wouldn't ever use the system local version. |
@ajdewit1994 To make further progress could you let us know:
Thanks! |
Hello, Thank you for your patience and sorry for the delay, I've been busy lately. To answer the questions:
That's
Yes
No, they are the same directory `~/flutter/ |
@ajdewit1994 If you don't mind, can you give the full path? (i.e. expand the Can you paste the output of running Do you get the same problems if you move your project into What happens if you run |
the ~/ == /home/albert/ output of running after copying the test\ project to the home folder of my user, I tried running To your last question, did you mean |
Do you get the same failures if you run under bash instead of zsh? Can you dump your entire environment? (output of What is the output of Thanks for still helping us try to track this down. I'm at an absolute loss as to what the problem could be. |
Should be helpful in tracking down flutter/flutter#8612. Prefer stack bounds from pthreads when available to be able to see frames below the Dart entry frame. R=johnmccutchan@google.com Review-Url: https://codereview.chromium.org/2813283002 .
Bash gives the same result Output of Output of |
I can reproduce something like this by running Flutter inside a directory with a non-UTF8 name:
Result:
I'm not sure if this is the same issue though. If I run
I get the same output if I run any other Dart script from this directory. |
I looked into this some more, and it seems that Dart generally assumes that filesystem paths are in UTF-8. Dart's runtime libraries are taking results from getcwd()/readdir()/etc. and feeding them to Dart_NewStringFromUTF8. In the --trace-compiler log in this bug, it looks like Dart is exiting from AndroidStudio._allLinuxOrWindows() in packages/flutter_tools/lib/src/android/android_studio.dart. In particular, it fails after getting the homeDirPath. The next thing we do after that is a listSync() on the homeDirPath. @ajdewit1994 If you run |
I bet what's happening is we're (or probably, something in the core libraries is) looking for some file in your home directory, and when you run as root the home directory is a different directory without any non-UTF8 characters, which is why it runs fine as root. |
Jesus, I feel dumb. You are right. A few months ago, I downloaded some stuff from a german university in a zip file, which, after I unzipped it, threw an encoding error. I didn't think much of it, threw it away since I couldn't read it. For some reason apparently, it puked something in my home folder. I'm very sorry for the inconvenience. I didn't know that the source of error would be something like this. It now runs |
@ajdewit1994 not your fault at all, we should not crash just because there's a badly encoded filename! |
Ok, I filed dart-lang/sdk#29451 to track the source of the crash. I'm gonna close this issue out now. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
I've installed flutter on my linux distro (arch). I ran
flutter doctor
Dart_NewStringFromUTF8 expects argument 'str' to be valid UTF-8.
Then I ran
sudo flutter doctor
[✓] Flutter (on Linux, channel master)
• Flutter at /home/albert/flutter
• Framework revision ca0201d (3 days ago), 2017-03-03 18:47:00
• Engine revision 342a311
• Tools Dart version 1.23.0-dev.2.0
[✗] Android toolchain - develop for Android devices
✗ Android SDK not found. Download from https://developer.android.com/sdk/
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] Android Studio (version unknown)
• Android Studio at /opt/android-studio
• Gradle version 3.2
[✓] IntelliJ IDEA Community Edition (version 2016.3)
• Dart plugin version 163.13137
• Flutter plugin version 0.1.11.1
[✓] Connected devices
• SHIELD Tablet K1 • 0424916012921008a8b8 • android-arm • Android 7.0 (API 24)
I (think) have correctly installed the android sdk tools/platform-tools. I've set the path variables
echo $PATH
/home/albert/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/opt/opencascade/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/home/albert/flutter/bin
yet nothing will change the little ✗ to a ✓
I've tried ignoring the doctor and just run the sample flutter app from my intellij editor, but I get the same
"Dart_NewStringFromUTF8 expects argument 'str' to be valid UTF-8."
Going manually to the project directory and running
sudo flutter run
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components.
The text was updated successfully, but these errors were encountered: