新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > win8下Android SDK環(huán)境變量安裝

win8下Android SDK環(huán)境變量安裝

作者: 時(shí)間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

一:下載 Android SDK

本文引用地址:http://2s4d.com/article/201609/305272.htm

http://developer.android.com/sdk/index.html

這里有兩種,一種是下載“ADT Bundle for Windows” ,這是個(gè)已經(jīng)集成好的Eclipse開發(fā)環(huán)境,已經(jīng)配置好所有的東西,只需要做安裝JDK和配置環(huán)境變量。

還有一種就是自己有Eclipse只是想單獨(dú)下載Android SDK的。這種情況請(qǐng)選擇“USE AN EXISTING IDE”,下載SDK Tools For Windows。

二:安裝Android SDK

這里我解壓下載的:ADT Bundle for Windows文件得到:adt-bundle-windows-x86_64-20130522目錄

選擇好安裝目錄,一路下一步就行了,注意:如果你沒有配置JAVA_HOME環(huán)境變量,Android SDK安裝檢測可能會(huì)報(bào)錯(cuò)。

配置Android SDK環(huán)境變量,這個(gè)是一個(gè)很容易出錯(cuò)的地方,如果只是下載了“ADT Bundle for Windows”,沒有配置這個(gè)環(huán)境變量的話,那么在啟動(dòng)虛擬機(jī)AVD的時(shí)候可能會(huì)出錯(cuò)。

ANDROID_SDK_HOME:設(shè)置你Android SDK的安裝目錄就行了。我的是:D:Androidandroid-sdk

PATH:把“%ANDROID_SDK_HOME%tools;%ANDROID_SDK_HOME%platform-tools;” 添加到系統(tǒng)環(huán)境變量path下。

三:在adt-bundle-windows-x86_64-20130522目錄下運(yùn)行SDK Manager.exe

發(fā)現(xiàn):

WIN8下的Android SDK 秒退了

解決辦法: 找到Android SDK的安裝目錄下 android-sdk-windows/tools/lib/find_java.bat批處理文件,備份一下。(隨便重命名,更改后綴格式)。

然后新建同名格式文件,將以下內(nèi)容粘貼復(fù)制,保存即可。

然后,啟動(dòng) SDK Manager ,可以打開窗口。

把find_java.bat中全部替換成下面的:

@echo off

rem Copyright (C) 2007 The Android Open Source Project

rem

rem Licensed under the Apache License, Version 2.0 (the License);

rem you may not use this file except in compliance with the License.

rem You may obtain a copy of the License at

rem

rem http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an AS IS BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

rem This script is called by the other batch files to find a suitable Java.exe

rem to use. The script changes the java_exe env variable. The variable

rem is left unset if Java.exe was not found.

rem Useful links:

rem Command-line reference:

rem http://technet.microsoft.com/en-us/library/bb490890.aspx

rem Check we have a valid Java.exe in the path. The return code will

rem be 0 if the command worked or 9009 if the exec failed (program not found).

rem Java itself will return 1 if the argument is not understood.

set java_exe=java.exe

rem search it in the path and verify we can execute it

for %%a in (%java_exe%) do set java_exe=%%~s$PATH:a

if not exist %java_exe% goto SearchForJava

%java_exe% -version 2>nul

if ERRORLEVEL 1 goto SearchForJava

goto :SearchJavaW

rem ---------------

:SearchForJava

rem We get here if the default %java_exe% was not found in the path.

rem Search for an alternative in %ProgramFiles%Java*binjava.exe

echo.

echo WARNING: Java not found in your path.

rem The strategy is to look for Java under these 3 locations:

rem - %ProgramFiles%, which may point to either a 32-bit or 64-bit install

rem depending on the current invocation context

rem - %ProgramW6432%, which points to a 32-bit install. This may not be defined.

rem - %ProgramFiles(x86)%, which points to a 64-bit install. This may not be defined.

if not defined ProgramFiles goto :Check64

echo Checking if Java is installed in %ProgramFiles%Java.

set java_exe=

for /D %%a in ( %ProgramW6432%Java* ) do call :TestJavaDir %%a

if defined java_exe goto :SearchJavaW

rem Check for the default 64-bit version if it's not the same path

:Check64

if not defined ProgramW6432 goto :Check32

if %ProgramW6432%==%ProgramFiles% goto :Check32

echo Checking if Java is installed in %ProgramW6432%Java instead (64-bit).

set java_exe=

for /D %%a in ( %ProgramW6432%Java* ) do call :TestJavaDir %%a

if defined java_exe goto :SearchJavaW

rem Check for the default 32-bit version if it's not the same path

:Check32

if not defined ProgramFiles(x86) goto :CheckFailed

if %ProgramFiles(x86)%==%ProgramFiles% goto :CheckFailed

echo Checking if Java is installed in %ProgramFiles(x86)%Java instead (32-bit).

set java_exe=

for /D %%a in ( %ProgramFiles(x86)%Java* ) do call :TestJavaDir %%a


上一頁 1 2 下一頁

關(guān)鍵詞:

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉