創建、刪除和瀏覽AVD之前,通常應該先為Android SDk設置一個環境變量:
ANDROID_SDK_HOME,該環境變量的值為磁盤上一個已有的路徑。
如果不設置環境變量,開發者創建的蓄意設備默認保存在
C:\Documents and Settings\<user_name>r\.android目錄下;
如果設置了ANDROID_SDK_HOME環境變量,那么虛擬設備就會保存在%ANDROID_SDK_HOME%/.android路徑下。
這里有一點非常容易混淆的地方,此處的%ANDROID_SDK_HOME%環境變量並不是Android SDK的安裝目錄。
設置方法:用戶變量
在環境變量里新建一個變量名:ANDROID_SDK_HOME,值為sdk的目錄,
然后編輯PATH,增加一個值 “%ANDROID_SDK_HOME%\tools”,
用命令行測試android,看看能否啟動android sdk and avd manager程序,成功后重啟eclipse,
查看window-perferences-android-build ,看default debug keystore 是否指向 ANDROID_SDK_HOME的位置。
If you face the same error, here are the step by step instructions:
- Open control panel
- Then go to System
- Then go to Change Environment Variables of the User
- Then click create a new environment variables
- Create a new variable named ANDROID_SDK_HOME
- Set its value to your Android directory, like
C:/users/<username>/.android
1.在環境變量中新建一個“系統變量”
變量名:ANDROID_SDK_HOME
值:K:\Android\android-sdk-windows\tools(注:我的sdk安裝在K盤)
2.修改系統變量Path,在前面添加%Android_SDK_HOME%/tools;
重啟eclipse,查看
window-perferences-android-build
default debug keystore:成功指向了K:\Android\android-sdk-windows\tools\.android\debug.keystore
2.安卓環境變量的配置。
下面我來介紹給大家環境變量的搭建、第一個是ANDROID_SDK_HOME: 路徑系統變量設置:第二個是Path:路徑系統變量設置。
第一步
ANDROID_SDK_HOME 路徑:先介紹相對路徑設置,不廢話,變量名:ANDROID_SDK_HOME,變量值是android-SDK-windows的路徑.
第二步
下面我們新建一個Path變量,
變量值方框里輸入.;%ANDROID_SDK_HOME%\platform-tools;%ANDROID_SDK_HOME%\tools;
需要注意的是最前面的.一定要有兩個%中間代表引用ANDROID_SDK_HOME的路徑,
然后將tools和platform-tools添加,不同的變量值之間用;隔開,注意中英文的分號不一樣滴。
2.1來介紹下相對路徑設置。
Path相對路徑值:.;%ANDROID_SDK_HOME%\platform-tools;%ANDROID_SDK_HOME%\tools
第三步
2.2來介紹下絕對路徑設置。
其實更簡單,設置變量名:Path,變量值設置:.;I:\Android\android-sdk-windows\platform-tools;I:\Android\android-sdk-windows\tools。(不要忘記了前面有點和分號,都是在英文輸入法下)
按照你自己安裝的platform-tools和tools的路徑設置。
I faced the same problem, which nearly drove me crazy.
System: Win7 64Bit, Eclipse/ADK 64 Bit, JRE7 64 Bit - latter copied from C:Programs\Java\ as "jre" under the Eclipse folder...
(finally Eclipse started).
How I solved the lacking start of the Emulator with an android virtual device:
-
Look under C:Users\YourUserName\ .android if you can find there a folder named \avd containing subfolders named after the android virtual devices you created.
If that is not the case (as it was on my machine) then you probably have moved long ago your account's user data via a symbolic link to some different location,
as it was the case in my system.
Eclipse (the virtual device manager of the ADK) will create the virtual devices there,
but will search for them in the Windows default C:Users\YourUserName\ .android path. -
Locate the real folder with your user data, in my case it was:
D:\Win\Users\YourUserName where I finally found the AVD-folders needed for Eclipse:
D:\Win\Users\YourUserName\ .android\avd...
(2 Subfolders with the avd's) -
Just copy the avd-folder (in my Example)
D:\Win\Users\YourUserName\ .android\avd to the "usual" Location, where Eclipse looks for it,
to C:\Users\YourUserName\ .android
This enabled me to : Start the virtual device and to load the Hello World example from Eclipse into it.
What did not help:
Create an environment variable named ANDROID_SDK_HOME with the value D:\Win\YourUserName\ .android
and add it to the environment variable paths list:
path= ....;%ANDROID_SDK_HOME%;....
Eclipse does not seem to search for such environment variables,
but obviously rather relies on the presence of all of the files in the Windows default locations of the user's personal data.
cheers