Installing Android SDK Tools - CodePath Android Cliffnotes

文章推薦指數: 80 %
投票人數:10人

The Android software development kit (SDK) includes different components, including SDK Tools, Build Tools, and Platform Tools. The SDK Tools primarily ... JumptoSectionTableofContentsInstallingtheAndroidSDK(AutomatedWay)InstallingforUbuntuLinuxInstallingtheAndroidSDK(viaHomebrew)InstallingtheAndroidSDK(ManualWay)InstallingviatheGUIPackagestoinstallInstallingviatheCommandLineInstallingAndroidSDKToolsEditPagePageHistoryTheAndroidsoftwaredevelopmentkit(SDK)includesdifferentcomponents,includingSDKTools,BuildTools,andPlatformTools.TheSDKToolsprimarilyincludesthestockAndroidemulator,hierarchyviewer,SDKmanager,andProGuard.TheBuildToolsprimarilyincludeaapt(Androidpackagingtooltocreate.APK),dx(Androidtoolthatconverts.javafilesto.dexfiles).PlatformToolsincludetheAndroiddebugshell,sqlite3andSystrace. TheAndroidSDKcanbeinstalledautomaticallyusingthelatestversionofGradleordownloadingtheAndroidSDKmanuallyinseveraldifferentways.Belowisanoverviewofalldifferentapproaches. InstallingtheAndroidSDK(AutomatedWay) Gradle2.2.0nowsupportsdownloadingautomaticallydependencies.MakesuretoupgradetothelatestGradleversion.TheGradleplugintomanagedependenciesisnowdeprecated. InstallingforUbuntuLinux IfyouareusingUbuntu15.04or15.10,makesuretoinstallthefollowingpackages.Otherwise,youmaynoticeNosuchfileordirectorywhenrunningtryingtoexecutetheaaptprogramthatispartoftheAndroidSDKtoolset: sudoapt-getinstalllibc6-dev-i386lib32z1openjdk-8-jdk InstallingtheAndroidSDK(viaHomebrew) AssumingyouhavemacOS/OSXrunning,youcanuseHomebrewtoinstalltheAndroidSDK. InstallHomebrew-thepackagemanagerformacOS/OSX Runthefollowingcommands: brewtaphomebrew/cask brewinstall--caskandroid-sdk ThiswillinstalltheAndroidSDKtoolsin/usr/local/Cellar/android-sdk/ InstallingtheAndroidSDK(ManualWay) YouwillneedtodownloadtheAndroidSDKwithoutAndroidStudiobundled.GotoAndroidSDKandnavigatetotheSDKToolsOnlysection.CopytheURLforthedownloadthat'sappropriateforyourbuildmachineOS. UsewgetwiththecorrectSDKURL: $wgethttps://dl.google.com/android/repository/tools_r25.2.3-macosx.zip Unzipandplacethecontentswithinyourhomedirectory.Thedirectorynamescanbeanythingyoulike,butsavethefilesinsomewhereeasytofind(i.e.~/android-sdk). Runthesdkmanagertool: $tools/bin/sdkmanager--update $tools/bin/sdkmanager"platforms;android-25""build-tools;25.0.2""extras;google;m2repository""extras;android;m2repository" $tools/bin/sdkmanager--licenses Nowit'stimetosetyourbuildenvironment'sPATHvariableandothervariablesthatwillbeusetolocateAndroid. Edityour.bash_profilefile.Ifyou'renotusingbash,edittherightconfigfileforyourenvironment. #Android exportANDROID_SDK_ROOT=/Users/ciandroid/android-sdk-macosx exportPATH=$PATH:$ANDROID_SDK_ROOT/tools Saveandquit.Reload.bash_profile: $source~/.bash_profile InstallingviatheGUI Attheprompt,typeandroidandhitEntertolaunchtheAndroidSDKManagerinawindow.Ifthisdoesn'twork,yourPATHvariablehasnotbeensetupwiththeAndroidSDKlocation. YouwillwanttoinstallthesameAndroidSDKpackagesonyourbuildmachineasyoudidtogetGradlerunninglocally.Beforeyoubegin,takealookatthebuild.gradlefileinyourproject. Packagestoinstall HerearetheSDKpackagenamesyou'lldefinitelywishtoselect: Tools>AndroidSDKTools Tools>AndroidSDKPlatform-tools Tools>AndroidSDKBuild-tools OneversionoftheAndroidPlatform.E.g.,Android5.1.1(API22).Itshouldbetheoneyounamedintheandroid:compileSdkVersionsectionofyourbuild.gradlefile. Youwillalsowanttodownloadtheextras: AndroidSupportRepository AndroidSupportLibrary Note:ChoosetheAndroidSDKBuild-toolsfortheversionofAndroidthatyoulistedinthebuild.gradlefileastheandroid:buildToolsVersiontarget.Ifyourbuild.gradlesays android{ buildToolsVersion'21' ... } thenmakesuretodownloadthatAPIversionintheAndroidSDKManager. InstallingviatheCommandLine YoucanalsodownloadtheSDKpackagesusingthecommandlinewiththe--no-uiparameter. androidupdatesdk--no-ui--all Ifyouwanttobeselectiveaboutinstalling,youcanuseandroidlisttoviewallthepackagesandapplythe--filteroptionforselectiveinstalls: sudoandroidupdatesdk--no-ui--filterplatform-tools,tools Ifyoudecidetobeselectiveaboutwhichpackagestobeinstalled,makesuretoincludetheextraAndroidMavenrepository.Otherwise,youmaynotbeabletousethelatestsupportdesignlibrary. androidupdatesdk--no-ui--all--filterextra-android-m2repository Thereiscurrentlynofiltertoinstallthebuildtoolsdirectly.Seethisticketformoreinformation.



請為這篇文章評分?