Open jfsanchez91 opened 2 years ago
Hi @jfsanchez91
I don't even have that java version (8.0.222-amzn) installed in my system
Looks like you installed this version before and it's still linked. Could you try removing this directory /home/USER/.sdkman/candidates/java/8.0.222-amzn/
and retry?
@huycozy that folder does not exist.
@jfsanchez91 Could you try creating a symbolic link from /home/USER/.sdkman/candidates/java/8.332.08.1-amzn/bin/java
to /home/USER/.sdkman/candidates/java/8.0.222-amzn/bin/java
then retry flutter doctor -v
?
@huycozy I already did that as a workaround, but I would really like to get rid of it. Why is flutter looking for that path?
@jfsanchez91 It looks like a Flutter tool's issue. Keeping this open for further investigation from the team.
I happened to be looking at this code just now, so I tried to work out how these reported symptoms could happen.
As far as I can tell, the answer will have to involve either the JAVA_HOME environment variable, or the PATH environment variable, pointing to that Java installation. The code that drives that "Java binary at:" message in the flutter doctor -v
output is the findJavaBinary
method in packages/flutter_tools/lib/src/android/android_sdk.dart
(via its call site in AndroidValidator.validate
), and I don't see another way it could be getting the answer it gets.
That leaves the mystery of why the flutter
tool is seeing such a JAVA_HOME (or such a PATH), when echo $JAVA_HOME
shows a different value in the user's shell.
I don't have an answer for that mystery. But, knowing nothing about how snaps work, my wild guess is that it's something to do with the snap. Perhaps /home/USER/.sdkman/candidates/java/8.0.222-amzn
was the value of JAVA_HOME when the snap was installed, and perhaps that somehow got baked into the snap? (Again, I have no idea how snaps work.)
@jfsanchez91 If you can still reproduce this issue, and you're interested in debugging it, my suggestion would be to use strace
, with a command like this:
strace -f -eexecve -v -s1024 flutter doctor -v 2>/tmp/trace
That'll dump a few hundred lines to the /tmp/trace
file. Then inspect that to see if the value of JAVA_HOME ever changes:
$ grep -o '"JAVA_HOME=[^"]*"' /tmp/trace | uniq -c
and to see if the value of PATH ever changes:
$ grep -o '"PATH=[^"]*"' /tmp/trace | uniq -c
I installed flutter using snap
$ sudo snap install flutter --classic
Here is my environment:
Here is the
flutter doctor -v
report:How can I solve the java verion error "
Cannot execute /home/USER/.sdkman/candidates/java/8.0.222-amzn/bin/java to determine the version
" reported? I don't even have that java version (8.0.222-amzn) installed in my systemThx in advance