Java Android Studio 模拟器不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29014116/
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-11 07:11:52  来源:igfitidea点击:

Android Studio emulator is not working

javaandroidandroid-studioemulation

提问by Nmaster88

i′ve searched about an awnser for this problem, tried many things, but still it doesn't Work. I'm using a win7 64-bit version. I've set the ANDROID_SDK_HOME variable and... nothing. With the path: C:\Users\Nuno\Favorites\.android\avd

我已经搜索了一个 awnser 来解决这个问题,尝试了很多东西,但仍然不起作用。我使用的是 win7 64 位版本。我已经设置了 ANDROID_SDK_HOME 变量......什么都没有。随着路径:C:\Users\Nuno\Favorites\.android\avd

The error is this:

错误是这样的:

Cannot launch AVD in emulator.
Output:
PANIC: HOME is defined but could not find PhoneTest.ini file in $HOME\.android\avd
(Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME\.android\avd and $HOME\.android\avd)

Can someone help me?

有人能帮我吗?

采纳答案by Nmaster88

It's working now!

它现在工作了!

How did i solved? I copied the AVM's i created from c:\user\favorites.android\avd and pasted them at c:\user.android\avd.

我是怎么解决的?我复制了我从 c:\user\favorites.android\avd 创建的 AVM 并将它们粘贴到 c:\user.android\avd。

Tbh i don't know why this happened but when i installed Android studio it created the first directory to put the avd's, while the HOME variable points to the second directory.

我不知道为什么会发生这种情况,但是当我安装 Android Studio 时,它创建了第一个目录来放置 avd,而 HOME 变量指向第二个目录。

After that i had a second problem, it said it couldn't create the temp file... I just had to execute Android studio with administrative privileges.

之后我遇到了第二个问题,它说它无法创建临时文件......我只需要以管理权限执行Android studio。

I hope it helps.

我希望它有帮助。

回答by chntgomez

I might not be answering your question but I strongly encourage you to switch for a new Android Emulator. Works prietty good for me:

我可能不会回答您的问题,但我强烈建议您切换到新的 Android 模拟器。对我有好处:

Genymotion Home Page

Genymotion主页

回答by Kalpa Gunarathna

Im glad you have solved the problem. This is the ubuntu version of your problem. Thisexplains why you need to admin privileges.

我很高兴你解决了这个问题。这是您的问题的 ubuntu 版本。 解释了为什么您需要管理员权限。

回答by whyoz

When AS was updated in Parallels and HAXM was installed after disabling Hyper-V, for me, the new avds somehow found their way into the Mac's .android folder? I previously installed AS on the Mac but wanted to separate Xcode and AS, so I used Windows for AS and uninstalled it on the Mac. When I opened AS from the dock, it was as if it was a fresh install and I didn't import settings...

当在 Parallels 中更新 AS 并在禁用 Hyper-V 后安装 HAXM 时,对我来说,新的 avds 不知何故进入了 Mac 的 .android 文件夹?之前在Mac上安装了AS,但是想把Xcode和AS分开,所以我用Windows做AS,在Mac上卸载了。当我从 Dock 打开 AS 时,就好像它是全新安装一样,我没有导入设置...

Solution was to grab all my old emulators (folders and .ini files) and pasted them into the Window's .android/avd folder.

解决方案是获取我所有的旧模拟器(文件夹和 .ini 文件)并将它们粘贴到 Window 的 .android/avd 文件夹中。

回答by Neoark Software

I was facing same issue when installed and configured android studio on ubuntu 14.04 (64 bit).

在 ubuntu 14.04(64 位)上安装和配置 android studio 时,我遇到了同样的问题。

After installation android studio successfully, when I run my app, I faced below issue:

成功安装android studio后,当我运行我的应用程序时,我遇到了以下问题:

Cannot launch AVD in emulator. Output: PANIC: HOME is defined but could not find Nexus_5_API_21.ini file in $HOME/.android/avd (Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME/.android/avd and $HOME/.android/avd)

无法在模拟器中启动 AVD。输出: PANIC: HOME is defined but could not find Nexus_5_API_21.ini file in $HOME/.android/avd (注意:avd是按照$ANDROID_AVD_HOME,$ANDROID_SDK_HOME/.android/avd and $HOME/.android/的顺序搜索的av)

I discovered reason of issue and find solution of the same. Reason was that I had downloaded android_studio at home directory (path:/home/ubuntu/android_studio). When I started studio (by using command: $sudo sh /home/ubuntu/android_studio/bin/studio.sh), which is actually installed at path /root/, it is trying to access "root" user files at path /root/.android/avd

我发现了问题的原因并找到了相同的解决方案。原因是我在主目录(路径:/home/ubuntu/android_studio)下载了 android_studio。当我启动工作室时(通过使用命令:$sudo sh /home/ubuntu/android_studio/bin/studio.sh),它实际上安装在路径 /root/ 中,它试图访问路径 /root 中的“root”用户文件/.android/avd

Ready to use solution is: Use command with root user ie

准备使用的解决方案是:使用 root 用户的命令即

#sh /home/ubuntu/android_studio/bin/studio.sh

#sh /home/ubuntu/android_studio/bin/studio.sh

in place of of

代替

$sudo sh /home/ubuntu/android_studio/bin/studio.sh

$sudo sh /home/ubuntu/android_studio/bin/studio.sh

回答by Wendell

Add environment variables ANDROID_AVD_HOMEor ANDROID_SDK_HOMEas your emulator really in(show in capture below). avd manager create emulator in maybe in another directory(default C:\Users[User Name].android\avd on Windows). As message show in tips, avdwill search xxxx/.android/avd. So you setting environment variables above can solve the problem. enter image description here

添加环境变量ANDROID_AVD_HOMEANDROID_SDK_HOME作为您的模拟器真正加入(显示在下面的捕获中)。avd 管理器可能在另一个目录中创建模拟器(Windows 上默认为 C:\Users[User Name].android\avd)。如提示中的消息所示,avd将搜索xxxx/.android/avd. 所以你在上面设置环境变量可以解决问题。 在此处输入图片说明

回答by Mauricio Moccellin

Worked with me by setting the variable ANDROID_SDK_HOME and path D: \ ANDROID_SDK in S.O Windowns 7 Thanks

通过在 SO Windowns 7 中设置变量 ANDROID_SDK_HOME 和路径 D:\ANDROID_SDK 与我一起工作谢谢