I'm trying to configure my arch linux distro in order to develop and run Flutter applications (for android). My problem is that when I try to run:
flutter run -v
it give me this error:
[+1614 ms] /opt/android-studio/jre/bin/java: symbol lookup error: /opt/android-studio/jre/lib/libnio.so: undefined symbol: initInetAddressIDs
[+2 ms] "flutter run" took 22,173ms. [ +10 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9) #2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1161:27) #3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #4 CommandRunner.runCommand (package:args/command_runner.dart:209:13) #5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9) #6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5) #8 run.. (package:flutter_tools/runner.dart:62:9) #9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19) #10 main (package:flutter_tools/executable.dart:94:3)
I've search and try possible solutions. The most specific and related solution for a similar problem was add to my $LD_LIBRARY_PATH the path of /usr/lib/jvm/java-8-openjdk/jre/lib/amd64/libnio.so, but it didn't work (doesn't change nothing). I also add to my $LD_LIBRARY_PATH this path "/usr/lib/jvm/java-17-openjdk/lib/server/" but also it didn't work. The link to this solution: Java symbol lookup error: /usr/lib64/jvm/java-11-openjdk-11/lib/libnio.so: undefined symbol: initInetAddressIDs
Another "solution" I try, was to run the app from Android Studio and it magically worked! That makes me feel even more worried because I don't understand why I can't run it from my CLI without have to open Android Studio (which consume more than half of my PC resources).
Important details:
- I have java-17-openjdk and java-8-openjdk. I'm currently using java-17-openjdk
- /opt/android-studio/ has a bin folder that contain a java-11 file. When I run an app from Android Studio it use the java-11 binary instead my java-17 (computer's default). This also appear when I ran an flutter app:
[ +177 ms] Exit code 0 from: /opt/android-studio/jre/bin/java -version [ ] openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) OpenJDK 64-Bit Server VM (build 11.0.11+0-b60-7590822, mixed mode)
Could please someone helps me or even explain me why this is happening?