eclipse Android 模拟器无法启动,因为文件夹错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6641498/
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
Android Emulator can't start, 'cause of wrong folder
提问by SamR1
I'm just starting to use Eclipse and ADT and I have some issues, the Android Emulator don't start :
我刚开始使用 Eclipse 和 ADT,但遇到了一些问题,Android 模拟器无法启动:
[2011-07-10 15:32:25 - Android_FirstApp] ------------------------------
[2011-07-10 15:32:25 - Android_FirstApp] Android Launch!
[2011-07-10 15:32:25 - Android_FirstApp] adb is running normally.
[2011-07-10 15:32:25 - Android_FirstApp] Performing samr1.Android_FirstApp.Android_FirstAppActivity activity launch
[2011-07-10 15:32:25 - Android_FirstApp] Automatic Target Mode: launching new emulator with compatible AVD 'Android2.1'
[2011-07-10 15:32:25 - Android_FirstApp] Launching a new emulator with Virtual Device 'Android2.1'
[2011-07-10 15:32:26 - Emulator] PANIC: Could not open: C:\Users\Sam\.android/avd/Android2.1.ini
The path isn't correct, though the path in Android2.1.ini is correct. The User folder is located in an another disk.
路径不正确,虽然Android2.1.ini 中的路径是正确的。用户文件夹位于另一个磁盘中。
How can I modify the start path of Android Emulator ? I can't find where.
如何修改 Android Emulator 的启动路径?我找不到在哪里。
Thanks
谢谢
EDIT : I found that graphical AVD Manager creates AVD directory inside C:\Users\.android\ on Windows 7 : Default location of AVD files
编辑:我发现图形 AVD 管理器在 Windows 7 上的 C:\Users\.android\ 中创建了 AVD 目录: AVD 文件的默认位置
But using Command Line doesn't work. So i moved my AVD files in C:\Users\Sam\ and now it works.
但是使用命令行不起作用。所以我将我的 AVD 文件移动到 C:\Users\Sam\ 中,现在它可以工作了。
回答by Daniel S. Fowler
This is a bug in the ADT Plugin. For a workaround until it is fixed use a NTFS symbolic link.
这是 ADT 插件中的一个错误。对于修复之前的解决方法,请使用 NTFS 符号链接。
I have a C: drive for windows 7 and a D: drive for all my work and data. After installing windows 7 I relocate all my special folders from C:\Users\John Doe to D:\John Doe. The ADT Plugin is trying to load the emulator from C: when it and the configure files are on D: (PANIC: Could not open etc.). NTFS can get the ADT Plugin to read from D: using a NTFS symbolic link. Open a command prompt in C:\Users\John Doe (obviously use your user name), use the mklink command.
我有一个用于 Windows 7 的 C: 驱动器和一个用于我所有工作和数据的 D: 驱动器。安装 Windows 7 后,我将所有特殊文件夹从 C:\Users\John Doe 重新定位到 D:\John Doe。ADT 插件试图从 C: 加载模拟器,当它和配置文件在 D: 上时(恐慌:无法打开等)。NTFS 可以使用 NTFS 符号链接从 D: 读取 ADT 插件。在 C:\Users\John Doe 中打开命令提示符(显然使用您的用户名),使用 mklink 命令。
mklink /J "C:\Users\John Doe\.android" "D:\John Doe\.android"
mklink /J "C:\Users\John Doe\.android" "D:\John Doe\.android"
Now when the ADT plugin is trying to reference .android on C:, NTFS sends the request to D: and the emulator starts correctly.
现在,当 ADT 插件尝试在 C: 上引用 .android 时,NTFS 会将请求发送到 D: 并且模拟器正确启动。
回答by David Aleu
- Create a environment variable called: ANDROID_SDK_HOME and set it to C:\Users\Administrator
- Open Eclipse > Window > Preferences and click in Run/Debug and String Substitution
- Add a new variable called: user.home and set it to C:\Users\Administrator
- Create an AVD and run it.
- 创建一个名为:ANDROID_SDK_HOME 的环境变量并将其设置为 C:\Users\Administrator
- 打开 Eclipse > Window > Preferences 并单击 Run/Debug and String Substitution
- 添加一个名为:user.home 的新变量并将其设置为 C:\Users\Administrator
- 创建一个 AVD 并运行它。
It should work now.
它现在应该可以工作了。
回答by gtiwari333
The configuration files for your emulator might have been saved by AndroidSDK and AVD Manager
some where else in your hard drive.
模拟器的配置文件可能已保存AndroidSDK and AVD Manager
在硬盘驱动器中的其他位置。
Do the following:
请执行下列操作:
- First search for the
.android folder
on you harddisk. - After you find that, move the
.android folder
to your user root directory - which may be"C:\Users\hallo\"
in your case.
- 首先
.android folder
在你的硬盘上搜索。 - 找到后,将 移动
.android folder
到您的用户根目录 - 这可能是"C:\Users\hallo\"
您的情况。
These type of project creation errors(with cause and solution) is described here.
回答by PravinDodia
The configuration files for your emulator might have been saved by AndroidSDK and AVD Manager some where else in your hard drive.
AndroidSDK 和 AVD 管理器可能已将模拟器的配置文件保存在硬盘的其他位置。
Do the following:
请执行下列操作:
First search for the .android folder on you harddisk. After you find that, move the .android folder to your user root directory - which may be "C:\Users\something\" in your case.
首先搜索硬盘上的 .android 文件夹。找到后,将 .android 文件夹移动到您的用户根目录 - 在您的情况下可能是“C:\Users\something\”。
Other Method
其他方法
Check the location of old folder you can open eclipse Navigate to Windows--> Preferences-->Android-->Expand it and Select Build Find the Value of Default Debug keystore and you will know your .android folder location.
检查旧文件夹的位置,您可以打开 eclipse 导航到 Windows--> Preferences-->Android-->Expand it and Select Build Find the Value of Default Debug keystore and you will know your .android folder location.
Then mklink /J "old folder location" "C:\Users\Something\"
然后 mklink /J "旧文件夹位置" "C:\Users\Something\"
回答by Solarin
if anyone is interested on the same problem in Linux (Ubuntu 11.10) the solution is NOT run Android SDK Manager as root. Aparently, SDK expects to be runned by a regular user, and it tries to work with the main user folder, that's why the error. This is what I suspect.
如果有人对 Linux (Ubuntu 11.10) 中的相同问题感兴趣,则解决方案不是以 root 身份运行 Android SDK Manager。显然,SDK 期望由普通用户运行,并且它尝试使用主用户文件夹,这就是错误的原因。这是我怀疑的。
回答by MSaudi
This worked for me by running eclipse as root ( in Ubuntu ), my be run as administrator will work
这通过以 root 身份运行 eclipse(在 Ubuntu 中)对我有用,我以管理员身份运行将起作用