最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Mac中运行sdkmanager报错:错误 找不到或无法加载主类 Shared

Mac crifan 583浏览 0评论
折腾:
【未解决】macOS中安装安卓开发工具aapt
期间,去macos中运行sdkmanager,结果报错:
crifanli@crifanlideMac  /Volumes/VMware Shared Folders/share_macOS/tools/aapt/tools/bin  ./sdkmanager --help
错误: 找不到或无法加载主类 Shared
竟然出错
关闭终端,重新试试
或许是路径中包含空格?
感觉也不太像啊
sdkmanager 错误: 找不到或无法加载主类 Shared
3. 最主要的,不能使用windows自带的zip解压,使用7zip完全没有这个问题
此处的
windows中的
commandlinetools-mac-6609375_latest.zip
右键用:
而解压出来的
D:\dev\VirtualMachine\share_macOS\tools\aapt\tools\bin
中的 几个文件都是6KB
看起来就不正常?除非都是link软连接文件?
否则应该大小不一才对
那去换到Mac中,把之前的:
commandlinetools-mac-6609375_latest.zip
去到Mac中解压
也是:bin下面几个 包括 sdkmanager都是5KB
去运行试试
至少可以正常运行了
-》反推之前出错,竟然原因真的是:
对于此处的:commandlinetools-mac-6609375_latest.zip
不能用windows的解压的结果,否则就会报错
改用Mac中 的解压缩,就没问题。真是见了鬼了。
-》估计内部是带了软链接?windows解压时不支持?
也没看到软链接啊
然后去对比看看
✘ crifanli@crifanlideMac  /Volumes/VMware Shared Folders/share_macOS/tools/aapt/tools/bin  ll
total 60
-rwx------  1 root  wheel   5.2K  1  1  2010 apkanalyzer
-rwx------  1 root  wheel   5.2K  1  1  2010 avdmanager
-rwx------  1 root  wheel   5.2K  1  1  2010 lint
-rwx------  1 root  wheel   5.2K  1  1  2010 screenshot2
-rwx------  1 root  wheel   5.2K  1  1  2010 sdkmanager


✘ crifanli@crifanlideMac  ~/dev/DevTools/android/tools/bin  ll
total 80
-rwxr-xr-x  1 crifanli  staff   5.2K  1  1  2010 apkanalyzer
-rwxr-xr-x  1 crifanli  staff   5.2K  1  1  2010 avdmanager
-rwxr-xr-x  1 crifanli  staff   5.2K  1  1  2010 lint
-rwxr-xr-x  1 crifanli  staff   5.2K  1  1  2010 screenshot2
-rwxr-xr-x  1 crifanli  staff   5.2K  1  1  2010 sdkmanager
-》两者唯一区别在于:
windows解压的  和 mac解压的 文件权限不同
  • windows解压的:
    • -rwx——
  • mac解压的
    • -rwxr-xr-x
      • (非该文件创建者也)拥有可执行权限
        • 所以才能正常运行
【总结】
此处,mac中运行sdkmanager报错:
错误: 找不到或无法加载主类 Shared
原因:
windows中解压 Mac版安卓的SDK工具包:
commandlinetools-mac-6609375_latest.zip
而得到的
tools/bin/sdkmanager
其文件权限是:
-rwx------
导致 当前用户没有权限?而无法正常运行,而报错
解决办法:改用Mac中去解压
步骤:
commandlinetools-mac-6609375_latest.zip
放到Mac中,进入Finder中双击,即可正常解压
然后即可正常运行sdkmanager。
附录:
SDK 平台工具版本说明  |  Android 开发者  |  Android Developers
“Android SDK 平台工具是 Android SDK 的一个组件。 它包含与 Android 平台进行交互的工具,例如 adb、fastboot 和 systrace。开发 Android 应用时需要使用这些工具。如果您想要解锁设备的引导加载程序并为其刷入新的系统映像,则同样需要使用这些工具。”

转载请注明:在路上 » 【已解决】Mac中运行sdkmanager报错:错误 找不到或无法加载主类 Shared

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.180 seconds, using 23.36MB memory