0

I'm having trouble getting Android CLI 4.0 to work as expected on my system. When I run which avdmanager, it always points to /opt/homebrew/bin/avdmanager, even though I've explicitly set my PATH to include the correct cmdline-tools/4.0/bin directory using export PATH=$PATH:$ANDROID_HOME/cmdline-tools/4.0/bin.

It appears that Android Studio is introducing this new path in /opt, and because of this, my specified cmdline-tools directory in the PATH is not taking precedence. I need to use CLI 4.0 with Java 11, but it seems that Java 11 is causing an issue with the CLI, resulting in the error:

vbnet Copy code Error: Se ha producido un error de enlace al cargar la clase principal com.android.sdklib.tool.AvdManagerCli java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/AvdManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 Interestingly, when I run $ANDROID_HOME/cmdline-tools/4.0/bin/avdmanager, everything works perfectly, and I don't encounter the error.

I need guidance on how to use CLI version 4.0 with Java 11 without Android Studio interfering with the path, and how to resolve the class version error when using Java 11.

Any help would be greatly appreciated. Thanks!

1 Answers1

0

I just delete the /opt/homebrew/bin/avdmanager and starts working

rm -rf /opt/homebrew/bin/avdmanager