I need to test my android app with android version 4.0.3 but I am unable to create an emulator with this Android version. Please check following screenshots for more details:
我需要用android版本4.0.3测试我的android应用,但是我无法用这个android版本创建一个模拟器。详情请参阅以下截屏:
Installed Intel x86 system image for version 4.0.3:
为4.0.3版本安装了Intel x86系统镜像:
No option for 4.0.3 version while selecting system image:
4.0.3版本选择系统镜像时,无选项:
Already tried following with no luck:
已经尝试了没有运气:
- Restarted Android Studio
- 重新启动Android工作室
- Moved x86 folder from system-images/android-15/default to system-images/android-15 folder
- 将x86文件夹从系统映像/android-15/默认文件移动到系统映像/android-15文件夹
How can I resolve this?
我该如何解决这个问题?
Edit:
编辑:
As suggested by BrentM, I tried to create it using android command line tool. It was successfully created, but when I tried to edit it from Android Studio, then it gives an error: The specified image file must be a valid image file.
正如BrentM所建议的,我尝试使用android命令行工具创建它。它成功创建,但是当我尝试从Android Studio编辑它时,它会出现一个错误:指定的图像文件必须是一个有效的图像文件。
Address of the image file in system: /Android/Sdk/system-images/android-15/x86
系统中图像文件的地址:/Android/Sdk/系统图像/Android -15/x86。
截图:
5 个解决方案
#1
2
You are almost there. After creating the AVD via the command line, find the location of your AVDs. On my Mac they are in the .android/avd folder in my home directory. For reference the name of my new AVD is Api-15-Gnex. I edited two files (I am guessing there is a bug of some sort otherwise this should all be done through GUI). I edited the following two files (change as you see fit for your situation). Below are the how they look like at the end:
你差不多了。通过命令行创建AVD后,找到AVD的位置。在我的Mac电脑上,它们在我的主目录的。android/avd文件夹中。我的新AVD的名字是Api-15-Gnex。我编辑了两个文件(我猜有某种错误,否则应该通过GUI来完成)。我编辑了以下两个文件(根据您的情况进行修改)。下面是它们最后的样子:
1) Api_15_Gnex.ini
1)Api_15_Gnex.ini
avd.ini.encoding=UTF-8
path=/Users/kaamel/.android/avd/Api-15-Gnex.avd
path.rel=avd/Api-15-Gnex.avd
target=android-15
2) Api-15-Gnex.avd/config.ini
2)Api-15-Gnex.avd / config.ini
avd.ini.encoding=UTF-8
AvdId=Api_15_Gnex
abi.type=x86
avd.ini.displayname=Api 15 Gnex
disk.dataPartition.size=4G
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=none
hw.camera.front=none
hw.cpu.arch=x86
hw.dPad=no
hw.device.hash2=MD5:6930e145748b87e87d3f40cabd140a41
hw.device.manufacturer=Google
hw.device.name=Nexus 4
hw.gps=yes
hw.gpu.enabled=no
hw.gpu.mode=off
hw.keyboard=yes
hw.lcd.density=320
hw.mainKeys=no
hw.ramSize=512
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-15/default/x86/
runtime.network.latency=none
runtime.network.speed=full
runtime.scalefactor=0.1
sdcard.path=/Users/kaamel/.android/avd/Api-15-Gnex.avd/sdcard.img
skin.name=768x1280
skin.path=768x1280
skin.path.backup=/Applications/Android Studio.app/Contents/plugins/android/lib/device-art-resources/nexus_4
tag.display=Default
tag.id=default
vm.heapSize=48
After the edit there were no error and I could edit and/or run it like other AVDs. Just notice that the paths are specific to my setup and you need to change them to yours (like my home directory is at Users/kaamel, or my Android Studio is installed at /Applications/Android Studio.app, etc).
在编辑之后,没有错误,我可以编辑和/或运行它像其他AVDs。请注意,路径是特定于我的设置的,您需要将它们更改为您的设置(比如我的主目录是用户/kaamel,或者我的Android Studio安装在/应用程序/Android Studio中)。应用程序,等等)。
Good luck!
好运!
Additional information:
附加信息:
Make sure to check the Api_15_Gnex.ini (or whatever you named your AVD) as well. The last line, "target=android-15", must match the image.file.sysdir.1 target. They both must be the same, in this case android-15. Once you do that, even if you get the error, click on Show Advanced Settings and correct other errors (like skin name, internal storage, etc.) and when there are no more errors click finish and let it regenerate the AVD.
确保检查Api_15_Gnex。ini(或任何你命名的AVD)。最后一行“target=android-15”必须与image.file.sysdir匹配。1目标。它们必须是相同的,在这里是android-15。一旦您这样做了,即使您得到了错误,单击Show Advanced Settings并纠正其他错误(如皮肤名称、内部存储等),当没有错误时,单击finish,让它重新生成AVD。
#2
1
Change your SD Storage location in Advanced Settings.
I ran into this error as well but found a simple solution that alluded me for a bit.
我也遇到了这个错误,但是我找到了一个简单的解决办法,这个办法暗示了我一点。
I didn't know why it was complaining about the SD image but when I hit advanced settings, I could see that the location for the simulator's external SD card image was not valid. Here's a screenshot:
我不知道为什么它会抱怨SD图像,但是当我点击高级设置时,我可以看到模拟器的外部SD卡图像的位置是无效的。这里有一个截图:
You could adjust that location but I decided to select the "Studio-managed" option.
您可以调整位置,但我决定选择“Studio-managed”选项。
Worked like a charm.
工作就像一个魅力。
This must have occurred during an Android Studio update because I didn't adjust these settings when creating the simulator or since.
这一定是在Android Studio更新期间发生的,因为我在创建模拟器时没有调整这些设置。
#3
0
If you are not seeing the system image in the Android Studio IDE you can create the virtual device using the android command line tool. Although it is no longer supported, I still use it and it still works.
如果您没有在Android Studio IDE中看到系统映像,您可以使用Android命令行工具创建虚拟设备。虽然不再支持它,但我仍然使用它,它仍然可以工作。
From the terminal/command line run:
从终端/命令行运行:
android list targets
This will list which targets are available, if you have downloaded an API 15 system image through the standalone SDK manager you should see it in the list. Take note of the id of the target you want to use to create an AVD, It should look something like id: 1 or "android-15"
这将列出哪些目标是可用的,如果您已经通过独立的SDK管理器下载了一个API 15系统映像,那么您应该在列表中看到它。注意要创建AVD的目标的id,它应该看起来像id: 1或“android-15”
Then create the AVD using the id from your list of targets, passing the target id as the -t parameter.
然后使用目标列表中的id创建AVD,并将目标id作为-t参数传递。
android create avd --force -n Android403-Api-15 -t 1
Returning to Android Studio, you should now see the AVD listed. You will need to edit the device to finish setting it up with the configuration you required (ie RAM, SD card...).
回到Android Studio,您现在应该会看到列出的AVD。您将需要编辑设备,以完成设置与您需要的配置(即RAM, SD卡…)。
See this post for more information.
更多信息请参见本文。
#4
0
To use intel x86
System Image you must install HAXM
Emulator Accelerator and configure your system BIOS.
要使用intel x86系统映像,必须安装HAXM仿真器加速器并配置系统BIOS。
for android 4.0.3 you can use armeabi-v7a
System Image
对于android 4.0.3,您可以使用armeabi-v7a系统映像
#5
0
Download the x86 image if you have 32 bit computer or try to download x86_64 image with google apis as recommended.
如果您有32位的计算机,请下载x86映像,或者尝试按照推荐的方式下载带有谷歌api的x86_64映像。
#1
2
You are almost there. After creating the AVD via the command line, find the location of your AVDs. On my Mac they are in the .android/avd folder in my home directory. For reference the name of my new AVD is Api-15-Gnex. I edited two files (I am guessing there is a bug of some sort otherwise this should all be done through GUI). I edited the following two files (change as you see fit for your situation). Below are the how they look like at the end:
你差不多了。通过命令行创建AVD后,找到AVD的位置。在我的Mac电脑上,它们在我的主目录的。android/avd文件夹中。我的新AVD的名字是Api-15-Gnex。我编辑了两个文件(我猜有某种错误,否则应该通过GUI来完成)。我编辑了以下两个文件(根据您的情况进行修改)。下面是它们最后的样子:
1) Api_15_Gnex.ini
1)Api_15_Gnex.ini
avd.ini.encoding=UTF-8
path=/Users/kaamel/.android/avd/Api-15-Gnex.avd
path.rel=avd/Api-15-Gnex.avd
target=android-15
2) Api-15-Gnex.avd/config.ini
2)Api-15-Gnex.avd / config.ini
avd.ini.encoding=UTF-8
AvdId=Api_15_Gnex
abi.type=x86
avd.ini.displayname=Api 15 Gnex
disk.dataPartition.size=4G
hw.accelerometer=yes
hw.audioInput=yes
hw.battery=yes
hw.camera.back=none
hw.camera.front=none
hw.cpu.arch=x86
hw.dPad=no
hw.device.hash2=MD5:6930e145748b87e87d3f40cabd140a41
hw.device.manufacturer=Google
hw.device.name=Nexus 4
hw.gps=yes
hw.gpu.enabled=no
hw.gpu.mode=off
hw.keyboard=yes
hw.lcd.density=320
hw.mainKeys=no
hw.ramSize=512
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=yes
hw.trackBall=no
image.sysdir.1=system-images/android-15/default/x86/
runtime.network.latency=none
runtime.network.speed=full
runtime.scalefactor=0.1
sdcard.path=/Users/kaamel/.android/avd/Api-15-Gnex.avd/sdcard.img
skin.name=768x1280
skin.path=768x1280
skin.path.backup=/Applications/Android Studio.app/Contents/plugins/android/lib/device-art-resources/nexus_4
tag.display=Default
tag.id=default
vm.heapSize=48
After the edit there were no error and I could edit and/or run it like other AVDs. Just notice that the paths are specific to my setup and you need to change them to yours (like my home directory is at Users/kaamel, or my Android Studio is installed at /Applications/Android Studio.app, etc).
在编辑之后,没有错误,我可以编辑和/或运行它像其他AVDs。请注意,路径是特定于我的设置的,您需要将它们更改为您的设置(比如我的主目录是用户/kaamel,或者我的Android Studio安装在/应用程序/Android Studio中)。应用程序,等等)。
Good luck!
好运!
Additional information:
附加信息:
Make sure to check the Api_15_Gnex.ini (or whatever you named your AVD) as well. The last line, "target=android-15", must match the image.file.sysdir.1 target. They both must be the same, in this case android-15. Once you do that, even if you get the error, click on Show Advanced Settings and correct other errors (like skin name, internal storage, etc.) and when there are no more errors click finish and let it regenerate the AVD.
确保检查Api_15_Gnex。ini(或任何你命名的AVD)。最后一行“target=android-15”必须与image.file.sysdir匹配。1目标。它们必须是相同的,在这里是android-15。一旦您这样做了,即使您得到了错误,单击Show Advanced Settings并纠正其他错误(如皮肤名称、内部存储等),当没有错误时,单击finish,让它重新生成AVD。
#2
1
Change your SD Storage location in Advanced Settings.
I ran into this error as well but found a simple solution that alluded me for a bit.
我也遇到了这个错误,但是我找到了一个简单的解决办法,这个办法暗示了我一点。
I didn't know why it was complaining about the SD image but when I hit advanced settings, I could see that the location for the simulator's external SD card image was not valid. Here's a screenshot:
我不知道为什么它会抱怨SD图像,但是当我点击高级设置时,我可以看到模拟器的外部SD卡图像的位置是无效的。这里有一个截图:
You could adjust that location but I decided to select the "Studio-managed" option.
您可以调整位置,但我决定选择“Studio-managed”选项。
Worked like a charm.
工作就像一个魅力。
This must have occurred during an Android Studio update because I didn't adjust these settings when creating the simulator or since.
这一定是在Android Studio更新期间发生的,因为我在创建模拟器时没有调整这些设置。
#3
0
If you are not seeing the system image in the Android Studio IDE you can create the virtual device using the android command line tool. Although it is no longer supported, I still use it and it still works.
如果您没有在Android Studio IDE中看到系统映像,您可以使用Android命令行工具创建虚拟设备。虽然不再支持它,但我仍然使用它,它仍然可以工作。
From the terminal/command line run:
从终端/命令行运行:
android list targets
This will list which targets are available, if you have downloaded an API 15 system image through the standalone SDK manager you should see it in the list. Take note of the id of the target you want to use to create an AVD, It should look something like id: 1 or "android-15"
这将列出哪些目标是可用的,如果您已经通过独立的SDK管理器下载了一个API 15系统映像,那么您应该在列表中看到它。注意要创建AVD的目标的id,它应该看起来像id: 1或“android-15”
Then create the AVD using the id from your list of targets, passing the target id as the -t parameter.
然后使用目标列表中的id创建AVD,并将目标id作为-t参数传递。
android create avd --force -n Android403-Api-15 -t 1
Returning to Android Studio, you should now see the AVD listed. You will need to edit the device to finish setting it up with the configuration you required (ie RAM, SD card...).
回到Android Studio,您现在应该会看到列出的AVD。您将需要编辑设备,以完成设置与您需要的配置(即RAM, SD卡…)。
See this post for more information.
更多信息请参见本文。
#4
0
To use intel x86
System Image you must install HAXM
Emulator Accelerator and configure your system BIOS.
要使用intel x86系统映像,必须安装HAXM仿真器加速器并配置系统BIOS。
for android 4.0.3 you can use armeabi-v7a
System Image
对于android 4.0.3,您可以使用armeabi-v7a系统映像
#5
0
Download the x86 image if you have 32 bit computer or try to download x86_64 image with google apis as recommended.
如果您有32位的计算机,请下载x86映像,或者尝试按照推荐的方式下载带有谷歌api的x86_64映像。