{"id":2767,"date":"2016-03-29T13:13:34","date_gmt":"2016-03-29T13:13:34","guid":{"rendered":"https:\/\/assignment.essayshark.com\/blog\/?p=2767"},"modified":"2023-01-10T07:46:49","modified_gmt":"2023-01-10T07:46:49","slug":"android-development-examples-application-development","status":"publish","type":"post","link":"https:\/\/assignmentshark.com\/blog\/android-development-examples-application-development\/","title":{"rendered":"Android Development Examples: Application Development"},"content":{"rendered":"<p><strong>ANDROID TASK:<\/strong><\/p>\n<p>Create new Android application which would allow the user to input some text, and then transfer this text to a separate TextView by clicking on it.<\/p>\n<p><strong>SOLUTION:<\/strong><\/p>\n<p>In this sample we are going to create a basic Android application using the official SDK, Android Studio (the installation of which also requires Java SDK being installed). Once Android Studio is installed and started, you will need to start a new Android Studio project.<!--more--><\/p>\n<p>First of all, you will be required to fill the \u201cApplication name\u201d and \u201cCompany Domain\u201d fields (in our case as \u201cSample_01\u201d and \u201cmycompany\u201d), as well as choose the location to store your project.<\/p>\n<p>The next window called \u201cTarget Android Devices\u201d requires you to select the form factors your application is going to run on. We are going to proceed with default selection \u201cPhone and Tablet\u201d.<\/p>\n<p>The selection of Android API version may be a bit tricky, as higher level versions have more features but are available to fewer devices (and vice versa, lower API levels target more devices but have fewer features available). In our case we will select API 19: Android 4.4 (KitKat), since it covers around 70% of devices.<\/p>\n<p>The next window called &#8220;Add an Activity&#8221; allows you to select an pre-set activity type to be added to your application. We are going to select \u201cBlank Activity\u201d.<\/p>\n<p>The next window called \u201cCustomize the Activity\u201d prompts us for Activity Name (we will use \u201cSampleActivity1\u201d name), as well as Layout Name, Title, and Menu Resource (we will leave automatically suggested names for these, which are \u201cactivity_sample1\u201d, \u201cSampleActivity1\u201d, and \u201cmenu_sample_activity1\u201d).<\/p>\n<p>After this you can finally click on \u201cFinish\u201d button.<\/p>\n<p>We now can see the files of project under the Project panel (which can be viewed in different modes, Android view being the default one). Let&#8217;s switch Project panel to Project view, and take a look at some project files:<\/p>\n<p>\u201capp\/src\/main\/res\/layout\/activity_sample1.xml\u201d<br \/>\n-XML layout file used for previewing and editing interface elements. You can see some of the elements being already in place by default, they were added since we selected \u201cBlank Activity\u201d rather than \u201cNo Activity\u201d.<\/p>\n<p>\u201capp\/src\/main\/res\/layout\/content_sample1.xml\u201d<br \/>\n-Another XML layout file, which contains, among some other settings, a TextView element which is used to display \u201cHello World!\u201d message (again, part of the default pack).<\/p>\n<p>\u201capp\/src\/main\/java\/mycompany.android001a\/SampleActivity1.java\u201d<br \/>\n-This file is used to store Java code for the default activity, which is used to load the aforementioned &#8216;Hello World!\u201d message.<\/p>\n<p>\u201capp\/build.gradle\u201d<br \/>\n-Gradle is used by Android Studio to compile and build the application, therefore each part of project (as well as project itself as a whole) has an appropriate \u201cbuild.gradle\u201d file. The main point of interest for us is the configuration data stored in these files, which can be modified in order to change SDK version used and other parameters.<\/p>\n<p>To run the application in its current state, select Run-&gt;Run app in the main menu (alternatively, click on &#8220;Run app&#8221; icon (green triangle), or press Shift+F10).<\/p>\n<p>You will be asked to choose the device to run your application at (these may include real Android devices connected to your PC, or emulated Android devices).<\/p>\n<p>In case you decide to use a real Android device connected to your PC, it may be not visible untile Developer mode\/USB Debugging is turned on in its settings, and the PC itself may<br \/>\nneed ADB driver installed.<\/p>\n<p>In case you decide to use virtual Android device (Android emulator), you will need to choose &#8220;Launch emulator&#8221; option. You can create\/edit\/configure Android Virtual Devices (AVDs)<br \/>\nin Tools-&gt;Android-&gt;AVD manager.<\/p>\n<p>Now the basic application can be seen running on Android (in our case Android emulator), showing the message &#8220;Hello World!&#8221;:<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen01.png\" rel=\"attachment wp-att-2769\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2769 size-full\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen01.png\" alt=\"android development examples\" width=\"474\" height=\"727\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen01.png 474w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen01-196x300.png 196w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><\/p>\n<p>This application also has the basic action (pink icon) which shows the &#8220;Replace with your own action&#8221; message on click. Finally, the menu icon on the blue bar above will show &#8220;Settings&#8221; tab on click, but it is also has no further functionality.<\/p>\n<p>Time to add new functionality to this application, such as an editable text field. For this, you will need to access the \u201capp\/src\/main\/res\/layout\/content_sample1.xml\u201d file. It will be opened in the Preview Pane. In the ComponentTree menu to the right from the preview, you can see the components, namely the &#8220;RelativeLayout&#8221; (which is our root view), and branching from it is TextView &#8220;Hello World!&#8221; (which is the child view).<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02.png\" rel=\"attachment wp-att-2771\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2771 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02-1024x451.png\" alt=\"android development examples_1\" width=\"604\" height=\"266\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02-1024x451.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02-300x132.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02-768x338.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen02.png 1037w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>Preview Pane has two modes shown as tabs below it: Design (graphical element-based) and Text (XML-based). By clicking on Text tab, you will switch it to XML mode.<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03.png\" rel=\"attachment wp-att-2773\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2773 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03-1024x450.png\" alt=\"android development examples_2\" width=\"604\" height=\"265\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03-1024x450.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03-300x132.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03-768x337.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen03.png 1034w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>There, underneath the section you can add a new section. You will be prompted to input width and height of this new element, and the final result should look like this:<\/p>\n<p>We can also add unique identifier to this new element:<\/p>\n<p>In this case &#8220;@&#8221; symbol denotes that we refer to a resource object, &#8220;+&#8221; symbol means that this resource is defined for the first time, and the &#8220;edit_text_element&#8221; is the name of the resource.<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen04.png\" rel=\"attachment wp-att-2775\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2775 size-full\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen04.png\" alt=\"android development examples_3\" width=\"648\" height=\"373\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen04.png 648w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen04-300x173.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a><\/p>\n<p>Next, access the \u201capp\/src\/main\/res\/values\/strings.xml\u201d file. This is a file containing the strings we can use as resources. By default it contains only two strings:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen05.png\" rel=\"attachment wp-att-2777\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2777 size-full\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen05.png\" alt=\"android development examples_4\" width=\"472\" height=\"142\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen05.png 472w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen05-300x90.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/a><\/p>\n<p>By doing so, a new string resource was created, which we can now use in \u201ccontent_sample1.xml\u201d<br \/>\nLet us add a new parameter to EditText using this string:<\/p>\n<p>android:hint=&#8221;@string\/edit_text_notifier&#8221;<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen06.png\" rel=\"attachment wp-att-2779\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2779 size-full\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen06.png\" alt=\"android development examples_5\" width=\"630\" height=\"389\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen06.png 630w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen06-300x185.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>This hint will be shown in EditText element before user enters any text. Notice how this is immediately reflected on the Preview Pane<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07.png\" rel=\"attachment wp-att-2783\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2783 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07-1024x450.png\" alt=\"android development examples_6\" width=\"604\" height=\"265\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07-1024x450.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07-300x132.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07-768x337.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen07.png 1029w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>We can enlarge and re-position the TextView and EditText elements by adding:<\/p>\n<p>android:layout_centerHorizontal=&#8221;true&#8221;<br \/>\nandroid:textSize=&#8221;32sp&#8221;<\/p>\n<p>to both elements, and additionally:<\/p>\n<p>android:layout_centerVertical=&#8221;true&#8221;<\/p>\n<p>to EditText element (to set EditText and TextView them apart visually).<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08.png\" rel=\"attachment wp-att-2785\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2785 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08-1024x451.png\" alt=\"android development examples_7\" width=\"604\" height=\"266\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08-1024x451.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08-300x132.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08-768x338.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen08.png 1034w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>Now let&#8217;s update TextView element.We will change &#8220;Hello World!&#8221; text to &#8220;Click to Update&#8221;:<\/p>\n<p>android:text=&#8221;Click to Update&#8221;<\/p>\n<p>We will add onClick method named &#8220;copyTextFromBelow&#8221;:<\/p>\n<p>android:onClick=&#8221;copyTextFromBelow&#8221;<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09.png\" rel=\"attachment wp-att-2787\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2787 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09-1024x453.png\" alt=\"android development examples_8\" width=\"604\" height=\"267\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09-1024x453.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09-300x133.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09-768x340.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen09.png 1028w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>Finally will add an identifier &#8220;text_line_element&#8221; to this element<\/p>\n<p>android:id=&#8221;@+id\/text_line_element&#8221;<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10.png\" rel=\"attachment wp-att-2789\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2789 size-large\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10-1024x451.png\" alt=\"android development examples_9\" width=\"604\" height=\"266\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10-1024x451.png 1024w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10-300x132.png 300w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10-768x338.png 768w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen10.png 1033w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>But now we need to actually define a method with such name. For this, access the \u201capp\/src\/main\/java\/mycompany.android001a\/SampleActivity1.java\u201d file. It contains SampleActivity1 class, within which we will create the &#8220;copyTextFromBelow&#8221; method:<\/p>\n<p>public void copyTextFromBelow(View view)<br \/>\n{<br \/>\nTextView textView = (TextView) findViewById(R.id.text_line_element);<br \/>\nEditText editText = (EditText) findViewById(R.id.edit_text.element);<br \/>\ntextView.setText(editText.getText());<br \/>\n}<\/p>\n<p>First of all, such view types as &#8220;TextView&#8221; and &#8220;EditText&#8221; will not be recognized unless they are imported. For this, we will need to add the following lines above the class:<\/p>\n<p>import android.widget.EditText;<br \/>\nimport android.widget.TextView;<\/p>\n<p>To explain the method itself, textView and editText are the in-method representations of views with ids &#8220;text_line_element&#8221; and &#8220;edit_text_element&#8221; respectively. We are using findViewById method to detect them. Afterwards getText() and setText() methods are used to apply text from one element to another.<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen11.png\" rel=\"attachment wp-att-2791\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2791 size-full\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen11.png\" alt=\"android development examples_10\" width=\"664\" height=\"451\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen11.png 664w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen11-300x204.png 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>Result of running the application (as shown through Android Virtual Device):<\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen12.png\" rel=\"attachment wp-att-2793\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2793\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen12-195x300.png\" alt=\"Screen12\" width=\"195\" height=\"300\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen12-195x300.png 195w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen12.png 472w\" sizes=\"auto, (max-width: 195px) 100vw, 195px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen13.png\" rel=\"attachment wp-att-2795\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2795\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen13-195x300.png\" alt=\"Screen13\" width=\"195\" height=\"300\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen13-195x300.png 195w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen13.png 474w\" sizes=\"auto, (max-width: 195px) 100vw, 195px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen14.png\" rel=\"attachment wp-att-2797\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2797\" src=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen14-196x300.png\" alt=\"Screen14\" width=\"196\" height=\"300\" srcset=\"https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen14-196x300.png 196w, https:\/\/assignmentshark.com\/blog\/wp-content\/uploads\/2016\/03\/Screen14.png 474w\" sizes=\"auto, (max-width: 196px) 100vw, 196px\" \/><\/a><\/p>\n<p><strong>TROUBLESHOOTING:<\/strong><\/p>\n<p>Below are some of the links with solutions to problems most likely to appear during the Android Studio installation and attempts to build\/run the application. Note that using Clean Project option each time after a new build was done, and killing adb.exe processes if there are too many of them may reduce some of the otherwise recurring errors.<\/p>\n<p><strong>Problem<\/strong>: Error mentioning Intel x86 Emulation Accelerator (HAXM installer) being not installed, hardware acceleration needed, and HAX kernel module not instaled.<br \/>\n<strong>Solution<\/strong>: Go to Tools-&gt;Android-&gt;SDK Manager and select &#8220;Intel x86 Emulation Accelerator (HAXM installer)&#8221; from SDK Tools list. After clicking &#8220;Apply&#8221; it should be installed. Next go to the folder mentioned in error message (the path shown usually looks like &#8220;C:\\Users\\User\\AppData\\Local\\Android\\sdk\\&#8221;). From there enter the following folders: &#8220;extras\\intel\\Hardware_Accelerated_Execution_Manager\\&#8221; and run intelhaxm-android.exe.<br \/>\nIn case the installer shows a problem message, such as &#8220;This computer does not support Intel Virtualization Technology (VT-X)&#8221; \u2013 when in fact your processor supports it \u2013 you should make sure that you have it enabled in BIOS (mind that some BIOS manufacturers do not include this option in the BIOS, but instead require additional software to be downloaded to access more options). If you are sure that it is enabled yet the error persists, you should go to Control Panel -&gt; Programs &amp; Features -&gt; \u201cTurn Windows features on or off\u201d, and make sure the &#8220;Hyper-V&#8221; checkbox is unchecked. Some antiviruses (such as Avast) also make use of Hardware-Assisted Virtualization, so you may need to disable it in antivirus as well for the installation to proceed.<\/p>\n<p><strong>Problem<\/strong>: New project creation is stuck on &#8220;Gradle: resolve dependencies&#8221;.<br \/>\n<strong>Solution<\/strong>: Make sure that your firewall (Windows Defender, or the one provided by your antivirus) allows Android Studio and Java to access the Internet. Another (although less likely) reason for this problem may be that the repository node Android Studio attempts to connect to is currently down.<\/p>\n<p><strong>Problem<\/strong>: Android Studio uses up too much memory, which may result in slowdown, Windows attempting to shut down Android Studio, errors such as &#8220;Cannot Set up guest memory &#8216;pc.ram&#8217; : invalid Argument Error accepting connection, aborting&#8221; and so on&#8230;<br \/>\n<strong>Solutions<\/strong>:<br \/>\nhttp:\/\/stackoverflow.com\/questions\/27176353\/android-studio-takes-too-much-memory<br \/>\n<iframe loading=\"lazy\" title=\"Cannot set up guest memory &#039;pc.ram&#039; : invalid argument error accepting connection, aborting--solved\" width=\"604\" height=\"340\" src=\"https:\/\/www.youtube.com\/embed\/dxi1OlS4jIc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><br \/>\nhttp:\/\/stackoverflow.com\/questions\/32883785\/why-does-android-emulator-increase-the-ram-size-automatically-and-make-me-fail-t<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"nZMKjOdEHX\"><p><a href=\"https:\/\/techzog.com\/development\/android-studio-high-ram-usage\/\" rel=\"nofollow noopener\" target=\"_blank\">Solving Android Studio High Memory Usage Problems<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Solving Android Studio High Memory Usage Problems&#8221; &#8212; TechZog.com - Technology. Blogging. SEO.\" src=\"https:\/\/techzog.com\/development\/android-studio-high-ram-usage\/embed\/#?secret=pz0SWbkzS7#?secret=nZMKjOdEHX\" data-secret=\"nZMKjOdEHX\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><br \/>\nThese can be narrowed down to:<br \/>\n<strong>Tip 1<\/strong>: decreasing JVM&#8217;s max heap size in vmoptions file located at C:\/Program Files\/Android\/Android Studio\/bin\/ (for 64-bit studio that would be studio64.exe.vmoptions) to something around Xmx512m<br \/>\n<strong>Tip 2<\/strong>: decreasing Gradle max heap size (no longer possible via options, but must be done on per-project basis by editing the gradle.properties file of your project), to the values around Xmx256m and XX:MaxPermSize=256m<br \/>\n<strong>Tip 3<\/strong>: decreasing Build Process Heap Size located at File-&gt;Other Settings-&gt;Default Settings-&gt;Build, Execution, Deployment-&gt;Compiler. It can be changed to something around 512 MB.<br \/>\n<strong>Tip 4<\/strong>: decreasing DEX Compiler Heap Size located at File-&gt;Other Settings-&gt;Default Settings-&gt;Build, Execution, Deployment-&gt;Compiler-&gt;Android Compiler. It can be changed to something around 400 MB.<br \/>\n<strong>Tip 5<\/strong>: downgrading Android Virtual Device properties. First and foremost, changing API for the latest one to the one &#8220;Marshmallow&#8221;\/23 to the one which is sufficient for our application: KitKat\/19. Nexus model with smaller than default screen can be selected, and unneeded features (such as camera emulation) can be turned off. RAM and VM heap values for Android Virtual Device can be also downgraded to, for example, 343 MB for RAM, and 64 MB for VM heap.<br \/>\n<strong>Tip 6<\/strong>: Turning VCM off and using another application to handle it instead.<\/p>\n<p><strong>Problem<\/strong>: \u201cThe following classes could not be instantiated: &#8211; android.support.design.widget.FloatingActionButton\u201c<br \/>\n<strong>Solution<\/strong>:<br \/>\nhttp:\/\/stackoverflow.com\/questions\/35675855\/android-studio-floatingactionbutton-error<br \/>\n(Gradle version must be edited and reverted to a stable one in case the most recent one is buggy)<\/p>\n<p><strong>Problem<\/strong>: \u201cError:Execution failed for task &#8216;:app:transformClassesWithDexForDebug&#8217;. \u2026<br \/>\n\u2026 java.exe&#8221; finished with non-zero exit value 2\u201d<br \/>\n<strong>Solution<\/strong>:<br \/>\nhttp:\/\/stackoverflow.com\/questions\/32889059\/android-studio-1-4-and-vector-image\/32889565#32889565<br \/>\n(multiDexEnabled must be set to true in defaultConfig section of build.gradle)<\/p>\n<h2>Help with Android Assignments<\/h2>\n<blockquote><p><em>This is one of our Android development examples that was written by one of our experts. You can also read one more <a href=\"https:\/\/assignmentshark.com\/blog\/android-development-sample\/\" target=\"_blank\" rel=\"noopener noreferrer\">Android Development Sample<\/a> posted on our blog.<\/em><\/p>\n<p><em> If you have difficulties with your IT projects, or just don&#8217;t understand some issues, you can contact us any time and get qualified <a href=\"https:\/\/assignmentshark.com\/\" target=\"_blank\" rel=\"noopener\">help with assignments<\/a>.<\/em><\/p>\n<p><em>By receiving <a href=\"https:\/\/assignmentshark.com\/android-homework-help.html\" target=\"_blank\" rel=\"noopener\">Android assignment help<\/a> from us, you will get an opportinuty to choose the expert to work with, to communicate with them in a live chat and pay for the assignment parts, when you are fully satisfied with them. Sounds terrific? We know. Hurry up to get our help.<\/em><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>ANDROID TASK: Create new Android application which would allow the user to input some text, and then transfer this text to a separate TextView by clicking on it. SOLUTION: In this sample we are going to create a basic Android application using the official SDK, Android Studio (the installation of which also requires Java SDK [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,35],"tags":[],"class_list":["post-2767","post","type-post","status-publish","format-standard","hentry","category-it","category-samples"],"_links":{"self":[{"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/posts\/2767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/comments?post=2767"}],"version-history":[{"count":13,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/posts\/2767\/revisions"}],"predecessor-version":[{"id":13577,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/posts\/2767\/revisions\/13577"}],"wp:attachment":[{"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/media?parent=2767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/categories?post=2767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmentshark.com\/blog\/wp-json\/wp\/v2\/tags?post=2767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}