我正在使用 Zorin 操作系统 (ubuntu) 当尝试运行 Cargo mobile2 时,出现以下错误: 无法打开 SDK 工具 是的,我可以确认 Android Home 中没有 Tools 文件夹,但有 build-tools。
ajinkya@Shivoham ~/Projects/2048-mobile master cargo mobile doctor
[✔] cargo-mobile v0.11.0
• Contains commits up to "Publish New Versions (#286)\n"
• Installed at "~/.cargo/.cargo-mobile2"
• Zorin OS v17.1
• rustc v1.77.0 (aedd173a2 2024-3-17)
[!] Android developer tools
✗ Failed to get SDK version: Failed to open "/home/ajinkya/Android/Sdk/tools/source.properties":
No such file or directory (os error 2)
• NDK v26.2.11394342 installed at "~/Android/Sdk/ndk/26.2.11394342/"
[✔] Connected devices
• No connected devices were found
导出变量。:
export ANDROID_SDK_ROOT="$HOME/Android/Sdk"
export ANDROID_HOME="$HOME/Android/Sdk"
export ANDROID_AVD_HOME="~/.android/avd"
export NDK_HOME="$ANDROID_HOME/ndk/26.2.11394342/"
export PATH=$PATH:$ANDROID_HOME/emulator/
export PATH=$PATH:$ANDROID_HOME/build-tools/34.0.0/
export PATH=$PATH:$ANDROID_HOME/platform-tools/
请检查您的 PATH 是否也包含 Android/Sdk/tools 条目。
export PATH=$PATH:$ANDROID_HOME/tools/
顺便说一句。您的“ANDROID_SDK_ROOT”的原因是什么?它对于 ANDROID_HOME 来说是多余的,而 ANDROID_HOME 才是正确的。