Android Studio for beginners, Part 3: Build and run the app- নতুনদের জন্য অ্যান্ড্রয়েড স্টুডিও, পার্ট 3: অ্যাপ্লিকেশনটি তৈরি করুন এবং রান করুন
Android_Studio_icon.svghttpsbdinfo190.blogspot.com |
We'll initial use Gradle to create the app's application package (APK) file. Then i am going to show you the way to line up Associate in Nursingd run the app on Associate in Nursing golem device ape or an actual device, during this case a Kindle hearth pill. i am going to additionally show you the way I resolved some of problems with golem Studio's device ape setup, together with the notorious regular out whereas waiting error.
[ Learn Java from starting ideas to advanced style patterns during this comprehensive 12-part course! ]
Note that this series has been updated for golem Studio three.2.1, this stable unleash as of this writing.
Building your golem app
If you followed on partially a pair of, you have already loaded your ASCII text file and resource files into your golem Studio project. currently you are able to build the app for the primary time.
If you haven't already, pop out golem Studio. The menu bar provides a Build menu, that you may use to access Gradle and build the instance application.
Select build Project from the Build menu. you must observe a Gradle Build Running message on the standing bar. when a touch whereas, you must observe a Gradle Build Finished message. Click on this message and also the Event Log window seems.
figure1
Jeff Friesen
Figure 1. The event log reveals no issues (click to enlarge)
There's quite a method to create Associate in Nursing golem app. as an example, you'll choose construct Project from the Build menu. Another approach is to truly run the app. If necessary, Gradle can mechanically construct the app before its APK is put in and also the app is run.
Do a lot of with the Build menu
Android Studio's Build menu helps you to perform many build tasks. as an example, you'll use the Generate Signed Bundle / APK menu item to create a signed app bundle or APK.
Running your golem app
In this section i am going to show you the way to run Associate in Nursing golem application 2 ways: initial on Associate in Nursing emulated device, then on Associate in Nursing actual device. For my example i will be mistreatment Associate in Nursing Amazon Kindle hearth HD pill, however the directions ought to usually apply to the device of your selection.
Run your golem app on Associate in Nursing emulated device
You can run the instance application (W2A) or the other app by choosing Run 'app' within the Run menu. as an alternative, you'll be able to click the inexperienced triangle button on the toolbar. Either way, golem Studio responds with the choose preparation Target panel.
figure2
Jeff Friesen
Figure 2. golem right Bridge (ADB) should be initialized so as to run Associate in Nursing golem app (click to enlarge)
After you have initialized the golem right Bridge, the message in Figure a pair of are replaced by an inventory of all connected USB devices and running emulators that are detected by golem Studio.
figure3
Jeff Friesen
Figure 3. choose the device or ape to run the app (click to enlarge)
In this case, golem Studio hasn't detected any connected USB devices or emulators, thus you will need to tack a replacement virtual device. Clicking produce New Virtual Device launches the panel shown in Figure four.
figure4
Jeff Friesen
Figure 4. Use the Virtual Device Configuration panel to settle on a tool to emulate (click to enlarge)
Select no matter device you would like to emulate. For this instance, I designated the highlighted (default) Nexus 5X. Click Next when you have created your choice.
The ensuing System Image panel invitations you to pick out a system image for this device emulation. I clicked the opposite pictures tab followed by IceCreamSandwich -- the highlighted line in Figure five.
figure5
Jeff Friesen
Figure 5. choose a system image for device emulation (click to enlarge)
You'll need to click the transfer link to transfer no matter system image you have chosen. The image is not put in by default. Before you'll be able to install the system image, you may even be bestowed with a license agreement.
figure6
Jeff Friesen
Figure 6. settle for the license agreement and click on Next (click to enlarge)
You must settle for the license agreement to continue. when acceptive the license agreement, you may be bestowed with the element Installer panel. At this time, the system image elements ar being downloaded and put in.
figure7
Jeff Friesen
Figure 7. Click end once installation is complete (click to enlarge)
Before continued, it is a smart plan to ascertain your work. Use the rear button to navigate out of the installation dialogs and back to the golem Virtual Device (AVD) panel. Here you'll be able to verify your settings for the ape AVD that may run your emulated device.
figure8
Jeff Friesen
Figure 8. Keep the default settings and click on end (click to enlarge)
For this instance, I selected to stay the default settings. you'll be able to keep the defaults or build no matter changes ar necessary, then click end. you must currently be came back to the choose preparation Target panel.
figure9
Jeff Friesen
Figure 9. Nexus 5X API fifteen is out there within the golem Virtual Device list (click to enlarge)
Highlight your chosen device entry and click on OK.
Android version history
Take a virtual tour of golem versions, from cake one.0 to Pie, free in August 2018.
Troubleshooting the golem device ape
Unfortunately, at this time within the installation you'll receive a message that Instant Run isn't supported. In my case, the standing bar bestowed a expecting target device to return on-line message Associate in Nursingd an empty ape window appeared.
figure10
Jeff FriesenFigure ten. The blank screen of death (click to enlarge)
Shortly when the ape window appeared, the Windows-based qemu-system-armel.exe program that is accountable for making this window crashed. (Recall from half one that i am running a 64-bit Windows software.)
figure11
Jeff FriesenFigure eleven. Windows notification concerning the crashed feasible
At first, I wasn't certain the way to fix this drawback. luckily, ensuing time I ran golem Studio three.2.1, I discovered Associate in Nursing IDE and Plugin Updates message within the lower-right space of golem Studio's main window.
figure12
Jeff Friesen
Figure 12. Click the Update link and follow directions to update the golem ape (click to enlarge)
I clicked the update link and followed directions to update the ape, that resulted in a very new qemu-system-armel.exe file.
No a lot of crashes, however I quickly hit another snag.
Waiting for target device to return on-line
When I tried running the app in my ape, the standing bar another time displayed a expecting target device to return on-line message, followed by the empty ape window.
Eventually, golem Studio gave informed waiting and bestowed the error message: Error whereas expecting device: regular out when three hundred seconds expecting ape to return on-line.
When I googled these messages, I discovered that a lot of others have practised this issue. Some developers have solved this drawback by sanctionative the AVD's Graphics process Unit hardware. It took some exploring to work this out, thus i am going to share what I learned, and hopefully prevent your time.
Enable AVD's Graphics process Unit
An AVD consists of many files and directories situated in a very directory with the .avd extension. as an example, the AVD I created is found in C:\USERS\Jeff\.android\avd\Nexus_5X_API_15.avd.
This directory contains a config.ini file, that stores configuration settings for the AVD. 2 settings caught my attention:
hw.gpu.enabled=no
hw.gpu.mode=off
I modified these entries to the following:
hw.gpu.enabled=yes
hw.gpu.mode=on
Enabling the Graphics process Unit solved the problem: ensuing time I tried to run the app, I discovered a properly running emulated Nexus 5X device.
figure13
Jeff Friesen
Figure 13. Unlock the device to visualize the app (click to enlarge)
I unlatched the device by mistreatment the mouse to swipe the lock icon to the proper. At this time the ape showed the instance app's main activity.
figure14
Jeff Friesen
Figure 14. Click the Animate button to run the animation (click to enlarge)
What concerning mistreatment the AVD Manager?
If you are like American state, you would possibly expect it's potential to vary the ape settings via the AVD Manager. as an example, Associate in Nursing AVD's configuration screen features a Graphics drop-down list box with software package - GLES one.1 (the default) and Hardware - GLES a pair of.0 entries. i attempted choosing Hardware - GLES a pair of.0, however the modification did not stick. I with success modified the hw.gpu entries within the config.ini file.
Running your golem app on a live device
Running Associate in Nursing app via a slow ape will be terribly frustrating. One answer is to use quicker emulation software package, like GenyMotion's Plugin for golem Studio. Another answer is to use Associate in Nursing actual golem device.
Some years agone, I purchased a first-generation Amazon Kindle hearth HD 7" pill, that runs golem four.0.3 (API Level 15). I still use this pill to run golem apps that do not need the most recent golem genus Apis.
While researching the way to use my Kindle hearth pill with golem Studio three.2.1, I found 2 helpful guides from Amazon: established Your Development setting for hearth pills and connect with hearth Tablet through ADB. i am going to summarize the method of connecting a Kindle hearth device to golem Studio, however check with these guides if you wish a lot of data.
First, if you are a Windows user like American state, you will need to begin by uninstalling the non-ADB driver that is put in once your Kindle hearth pill is connected to your development laptop, while not initial sanctionative ADB. Then you may install Amazon's USB driver.
Next, transfer the Kindle hearth USB driver. The downloaded nothing archive contains a Fire_Devices ADB drivers.exe application.
Execute Fire_Devices ADB drivers.exe and follow directions. I finished up with a C:\Program Files (x86)\Amazon.com\Fire_Devices\Drivers directory containing the mandatory driver files.
After putting in the drivers, you will need to modify ADB on your pill. Then, you may connect the pill to your development laptop. See the Amazon guide if you wish extra directions for connecting your pill to golem Studio.
Once you have got everything established, begin golem Studio, load your golem project, and run the app. This time, the choose preparation Target panel ought to show Associate in Nursing Amazon KFTT entry within the Connected Devices section. choose this entry and click on OK. golem Studio responds by guiding Gradle to create the app. Once that is done, it'll install the app's APK and run the app on the device.
figure15
Jeff FriesenFigure fifteen. Click Animate to perform the animation (click to enlarge)
Conclusion to half three
You've written, built, and run your initial golem Studio application mistreatment golem three.2.1 or higher, and you have done some troubleshooting on the means. As a next step, I recommend experimenting with what you have learned. Use the examples and ASCII text file from the primary 3 golem beginner tutorials to develop a replacement project of your own. Keep your comes easy whereas you learn the ins and outs of operating with golem Studio and its inherent options, however do challenge yourself to experiment.
Of course, there is a lot of you'll be able to do with golem Studio. the ultimate article during this series introduces 3 inherent tools for work, debugging, and linting your golem apps. We'll additionally extend golem Studio with 3 productivity plugins, together with Project Lombok.
Until then, happy coding!
Casino Del Sol opens new doors on its new tower with a casino
ReplyDeleteCasino 상주 출장마사지 Del Sol has opened its doors to a 의왕 출장마사지 new expansion 아산 출장안마 after years of trying to 경기도 출장마사지 remain open since opening 과천 출장안마 its doors in 2014.