Linux Ubuntu - 错误:无法创建 SD 卡

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3878445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:41:58  来源:igfitidea点击:

Ubuntu - Error: Failed to create the SD card

androidlinuxubuntu

提问by Alex Pritchard

I see a lot of posts about writing to the SD card, but I believe my problem is different. I am unable to create the SD card during the process of building an AVD.

我看到很多关于写入 SD 卡的帖子,但我相信我的问题是不同的。我在构建 AVD 的过程中无法创建 SD 卡。

I initially tried to use the Android SDK and AVD Manager to do this, selecting
Name: my_avd
Target: Android 2.2 - API Level 8
SD Card: Size: 1024 MiB
Skin: Built-In: Default (HVGA)
Hardware: Property: Abstracted LCD Density, Value: 160

我最初尝试使用 Android SDK 和 AVD 管理器来执行此操作,选择
名称:my_avd
目标:Android 2.2 - API 级别 8
SD 卡:大小:1024 MiB
皮肤:内置:默认(HVGA)
硬件:属性:抽象 LCD密度,值:160

This pops up a window with the message:
"Result of creating AVD 'my_avd':
Error: Failed to create the SD card."

这会弹出一个带有消息的窗口:
“创建 AVD 'my_avd' 的结果:
错误:无法创建 SD 卡。”

I tried to repeat the process from the command line, receiving a similar error:

我试图从命令行重复该过程,收到类似的错误:

alex@alex-desktop:~$ android create avd -n my_avd -t 1 -c 1024M
Android 2.2 is a basic Android platform.
Do you wish to create a custom hardware profile [no]no
Error: Failed to create the SD card.

Attempting to follow instructions for using mksdcard was equally unproductive; I think my basic lack of linux experience may be causing me a problem here. When I try to use mksdcard, it just reports that it cannot find the file or directory. Is the mksdcard tool available for use this way in linux?

尝试遵循使用 mksdcard 的说明同样无济于事;我认为我基本缺乏 linux 经验可能会导致我在这里出现问题。当我尝试使用 mksdcard 时,它只是报告找不到文件或目录。mksdcard 工具是否可以在 linux 中以这种方式使用?

alex@alex-desktop:~$ mksdcard 1024M ./sdcard.iso
bash: /home/alex/android-sdk-linux_x86/tools/mksdcard: No such file or directory
alex@alex-desktop:~$ sudo android create avd -n my_avd -t 1 -c 1024M

I've added the android tools directory to my PATH variable, but I feel like there is obviously something else I'm missing. Perhaps some kind of access rights?

我已将 android 工具目录添加到我的 PATH 变量中,但我觉得显然我还缺少其他东西。也许某种访问权限?

Attempting to run the android command with sudo did not seem to help either:

尝试使用 sudo 运行 android 命令似乎也没有帮助:

alex@alex-desktop:~/android-sdk-linux_x86/tools$ sudo ./android create avd -n my_avd -t 1 -c 1024M
Android 2.2 is a basic Android platform.
Do you wish to create a custom hardware profile [no]no
Error: Failed to create the SD card.

I even tried installing Eclipse and the ADT plugin and running the manager from there to no avail. Any tips would be most appreciated. Advanced warning that I am somewhat of a novice Linux user, so even if it seems like a no-brainer obvious thing to check, I could still have missed it.

我什至尝试安装 Eclipse 和 ADT 插件并从那里运行管理器无济于事。任何提示将不胜感激。高级警告,我是一个 Linux 新手,所以即使检查这件事看起来很简单,我仍然可能会错过它。

采纳答案by Alex Pritchard

So I found the problem. I was using a 64-bit Linux install, which did not have the ia32-libs package installed by default. The mksdcard utility will not run without this package. After installing it, I was able to build the AVD without a problem using the AVD manager.

所以我发现了问题。我使用的是 64 位 Linux 安装,默认情况下没有安装 ia32-libs 包。如果没有这个包,mksdcard 实用程序将无法运行。安装后,我能够使用 AVD 管理器毫无问题地构建 AVD。

回答by paulsm4

I just encountered the same problem. NONE of the SDK tools will run on 64-bit Ubuntu without installing ia32-libs (EXAMPLE: sudo apt-get install ia32-libs).

我刚刚遇到了同样的问题。如果不安装 ia32-libs(示例:sudo apt-get install ia32-libs),任何 SDK 工具都不会在 64 位 Ubuntu 上运行。

回答by cynicholas

I had the same error like you and I have just solved it, so maybe it can help you (though I don't think your error is caused by the same problem like me).

我有和你一样的错误,我刚刚解决了它,所以也许它可以帮助你(虽然我不认为你的错误是由和我一样的问题引起的)。

I found that all tools in ../tools don't have the permission to excute, so I used

我发现../tools中的所有工具都没有执行权限,所以我用

chmod -R 777 ../tools

from the command line and it finally works

从命令行,它终于工作

回答by Andrew Paul Simmons

I had a different problem: platform-tools was in my path but tools was not. So, everything worked except that the SDCard image was not created. There was no notice of this when I created the avd in eclipse and the virtual device was created with a really small sd card causing it to constantly throw the media not available error on app install.

我有一个不同的问题:平台工具在我的道路上,但工具不在。因此,除了未创建 SDCard 映像外,一切正常。当我在 eclipse 中创建 avd 时没有注意到这一点,并且虚拟设备是用一个非常小的 SD 卡创建的,导致它在应用程序安装时不断抛出媒体不可用错误。

回答by imon_iut

alex@alex-desktop:~$ mksdcard 1024M ./sdcard.iso
bash: /home/alex/android-sdk-linux_x86/tools/mksdcard: No such file or directory
alex@alex-desktop:~$ sudo android create avd -n my_avd -t 1 -c 1024M

I have found this problem & i find a way first:

我发现了这个问题,我首先找到了一个方法:

cd /home/alex/android-sdk-linux_x86/tools/

then write this:

然后写这个:

sudo chmod 755 mksdcard
mksdcard 1024M ./sdcard.iso
sudo android create avd -n my_avd -t 1 -c 1024M

it should work :)

它应该工作:)

回答by CosmicCat

I had a different problem using 32bit Ubuntu. When i tried to run mksdcard by hand, I was getting a file not found error.

我在使用 32 位 Ubuntu 时遇到了不同的问题。当我尝试手动运行 mksdcard 时,出现文件未找到错误。

The problem was open-jre/jdk. I installed oracle java and the problem was fixed. Unfortunately you can no longer install oracle java through apt/synaptic and have to jump through some extra hoops:

问题是 open-jre/jdk。我安装了oracle java,问题解决了。不幸的是,您不能再通过 apt/synaptic 安装 oracle java,并且必须跳过一些额外的环节:

https://github.com/flexiondotorg/oab-java6

https://github.com/flexiondotorg/oab-java6

回答by SerVel

MyOS is Oracle Unbreakable Linux 6 - to solve this issue I had to install libstdc++-4.4.6-3.el6.i686 package.

MyOS 是 Oracle Unbreakable Linux 6 - 为了解决这个问题,我必须安装 libstdc++-4.4.6-3.el6.i686 包。

回答by rubenj

Also had this problem and after installing the i386 package I was able to create a SD-card for my Android emulator I had to do two steps

也有这个问题,安装 i386 包后,我能够为我的 Android 模拟器创建一个 SD 卡,我必须做两个步骤

sudo apt-get update
sudo apt-get install ia32-libs

After this was finished, I was able to create an emulator with a SD-card attached

完成后,我能够创建一个带有 SD 卡的模拟器

回答by user3133745

Try moving the android sdk folder to home folder. It works.

尝试将 android sdk 文件夹移动到主文件夹。有用。

回答by Paolo Rovelli

As others have already written, the problem is that your Linux distro is a 64-bitone and, at present, Android Virtual Device(AVD) needs the x86library to work correctly.

正如其他人已经写过的那样,问题在于您的 Linux 发行版是64 位发行版,目前,Android 虚拟设备( AVD) 需要x86库才能正常工作。

Someone has suggested to install ia32-libs. However, in Ubuntu 14.04 LTSyou won't find this library. I solved using these alternative libs: lib32z1, lib32ncurses5, lib32bz2-1.0and lib32stdc++.

有人建议安装ia32-libs。但是,在Ubuntu 14.04 LTS 中你不会找到这个库。我使用这些替代库解决了问题:lib32z1lib32ncurses5lib32bz2-1.0lib32stdc++

sudo apt-get update
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++