{"id":472,"date":"2019-10-12T20:21:08","date_gmt":"2019-10-12T10:21:08","guid":{"rendered":"https:\/\/learntodroid.com\/?p=472"},"modified":"2019-10-12T20:27:30","modified_gmt":"2019-10-12T10:27:30","slug":"a-beginners-guide-to-using-the-android-sdk-in-android-studio","status":"publish","type":"post","link":"http:\/\/10.0.0.14:32769\/a-beginners-guide-to-using-the-android-sdk-in-android-studio\/","title":{"rendered":"A Beginners Guide to Using the Android SDK in Android Studio"},"content":{"rendered":"\n
Android Studio requires you to have the Android SDK on your machine or you will not be able to create or build Android apps. Today when you do a fresh install of Android Studio it will come with the option to install the Android SDK.<\/p>\n\n\n\n
An SDK, which stands for Software Development Kit, is a virtual toolbox used by programmers that contains software libraries you can reuse when coding an application rather than having to code everything from scratch saving effort. <\/p>\n\n\n\n
The Android SDK offers a wide range of development tools for Android app developers which includes:<\/strong><\/p>\n\n\n\n The debugger is available in Android Studio and can be used to you help locate and fix defects within your code.<\/p>\n\n\n\n In Android Studio you can set breakpoints in your code where you want to code execution to pause so that you can debug at that point in time. To create a breakpoint in Android Studio, find the line of code you want to set the breakpoint then left click to the right of the line number of the code and you should see a red circle appear.<\/p>\n\n\n\n Once you have set you breakpoint, you can start debugging your application by selecting the debug icon, which looks like a green bug to the right of the run application button. This will launch your application in the emulator and proceed to pause the execution of your code at the line you have set your breakpoint.<\/p>\n\n\n\n You can use the debugger view at the bottom of Android Studio under the Debug tab to view the call stack of methods, as well as the current value of all the variables at that point in time. You can use the functions available in the Debug tab to step through subsequent lines in your code one step at a time, while observing the changes to the call stack and variables.<\/p>\n\n\n\n The Android SDK includes many libraries that make your life easier as a software developer creating Android apps. The Android SDK libraries includes the Android support library<\/a> and the AndroidX library. Use of the AndroidX library is recommended for all new projects.<\/p>\n\n\n\n Use the Android Developer website to find the list of packages under both the Android support library<\/a> and AndroidX library<\/a> which you can utilise by importing these packages using the import <\/em><\/strong>keyword at the top of your class referencing the package name.<\/p>\n\n\n\n For example, to import the Fragment class from the AndroidX library<\/p>\n\n\n\n The Android SDK comes with an emulator which is supported in the Android Studio IDE. The emulator allows you to interact with your Android apps on your local machine without needing to install your app on a physical handset, simplifying and speeding up the development process.<\/p>\n\n\n\n The emulator supports basic handset controls such as:<\/p>\n\n\n\n The emulator also supports more advanced handset controls such as:<\/p>\n\n\n\n The Android SDK comes with an Android Virtual Device (AVD) Manager accessible through Android Studio. The AVD Manager allows you to create virtual devices that are run by the handset emulator.<\/p>\n\n\n\n You can create a wide range of virtual devices across different categories including Android TVs, Phones, Tablets and Wear OS to use on the emulator.<\/p>\n\n\n\n Using the Android SDK Manager in Android Studio you can download the Android SDK documentation to your local machine by following the instructions below.<\/p>\n\n\n\n To access the documentation when in Android Studio, highlight the method name or type and press the “Shift” and “F1” keys at the same time which will open the documentation based on the selection in the web browser.<\/p>\n\n\n\n To view the same documentation in Android Studio, highlight the relevant text then press the “Ctrl” and “Q” keys for Windows or “F1” for Mac.<\/p>\n\n\n\n To find the full set of documentation to view in your browser, navigate to your Android SDK path (see “How can I find the Android SDK path in Android Studio” section bellow) and open up the index.html file into the web browser which is located in the “docs” folder within Android SDK directory<\/p>\n\n\n\n The Android SDK offers a large range of sample code you can import into your project. You can browse the samples that have been created in Android Studio then import them into a new project.<\/p>\n\n\n\n Some of the examples of sample code available today include:<\/p>\n\n\n\n To import sample code into a new project in Android Studio <\/p>\n\n\n\n If you want to find out the location of the Android SDK that is being used by Android Studio on your computer, follow the steps below the find the Android SDK path.<\/p>\n\n\n\n To find the Android SDK path in Android Studio:<\/p>\n\n\n\n The terms of the license agreement<\/a> for the Android SDK are available on the Android developers website. You will need to accept the license agreement in order to use the Android SDK. <\/p>\n\n\n\n Reviewing and accepting the license agreement for the Android SDK will be triggered during the installation process.<\/p>\n\n\n\n You can also accept the license agreement for the Android SDK in the command line using the sdkmanager tool<\/a> with the following command.<\/p>\n\n\n\n Upgrades to the Android SDK can be managed in Android Studio using the SDK Manager accessible via the “File” menu under “Tools”, “SDK Manager”.<\/p>\n\n\n\n In the SDK Platforms tab you can trigger upgrade to the newest revision of existing SDK Platforms you have downloaded or an entirely new SDK Platform.<\/p>\n\n\n\n New versions of the Android SDK are releasing on roughly a yearly basis.<\/p>\n\n\n\n Android Studio requires you to have the Android SDK on your machine or you will not be able to create or build Android apps. Today when you do a fresh<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[13],"tags":[],"acf":[],"_links":{"self":[{"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/posts\/472"}],"collection":[{"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":5,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/posts\/472\/revisions"}],"predecessor-version":[{"id":525,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/posts\/472\/revisions\/525"}],"wp:attachment":[{"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/media?parent=472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/categories?post=472"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/10.0.0.14:32769\/wp-json\/wp\/v2\/tags?post=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}Tools in the Android SDK<\/h2>\n\n\n\n
Debugger<\/h3>\n\n\n\n
Libraries<\/h3>\n\n\n\n
import androidx.fragment.app.Fragment;<\/code><\/pre>\n\n\n\n
Emulator<\/h3>\n\n\n\n
Documentation<\/h3>\n\n\n\n
Sample Code<\/h3>\n\n\n\n
How can I find the Android SDK path in Android Studio?<\/h2>\n\n\n\n
How to change the Android SDK path in Android Studio<\/h2>\n\n\n\n
How does licensing work with the Android SDK?<\/h2>\n\n\n\n
yes | sdkmanager --licenses<\/code><\/pre>\n\n\n\n
How can I upgrade the Android SDK in Android Studio?<\/h2>\n\n\n\n
What are the differences between Android SDK build tools, platform tools and tools?<\/h2>\n\n\n\n
Name<\/strong><\/td> Description<\/strong><\/td> Category<\/strong><\/td><\/tr> Emulator<\/a><\/td> Used for running your Android app on a virtual device<\/td> tool<\/td><\/tr> ProGuard<\/td> Code optimization<\/td> tool<\/td><\/tr> mksdcard<\/a><\/td> Create a FAT32 disk image for use in the emulator<\/td> tool<\/td><\/tr> avdmanager<\/a><\/td> Create and manage Android Virtual Devices<\/td> tool<\/td><\/tr> sdkmanager<\/a><\/td> View, install, update, and uninstall packages for the Android SDK <\/td> tool<\/td><\/tr> jobb<\/a><\/td> Tool for building OBB files that are used for supplying assets such as graphics, video and audio for Android apps and kept separate from the APK<\/td> tool<\/td><\/tr> APK Signer<\/a><\/td> Sign your APK<\/td> build tool<\/td><\/tr> D8<\/a><\/td> Compiles Java bytecode into dex files<\/td> build tool <\/td><\/tr> DX<\/td> Compiles Java bytecode into dex files <\/td> build tool <\/td><\/tr> adb<\/a><\/td> Android Debug Bridge used to communicate with devices<\/td> platform tools<\/td><\/tr> dmtracedump<\/a> <\/td> Tool that generates graphical call-stack diagrams from trace log files <\/td> platform tools <\/td><\/tr> etc1tool<\/a><\/td> encode PNG images to the ETC1 compression standard and decode ETC1 compressed images back to PNG <\/td> platform tools<\/td><\/tr><\/tbody><\/table>\n","protected":false},"excerpt":{"rendered":"