Can't run a hello world program in Android Studio - android

I just installed the latest Android Studio to get started off with Android app development. I have 2 GB of RAM running in my 32-bit laptop. As soon as I try to run the basic hello world program, it gives me the following error message. I don't understand this. Do I have all the necessary packages installed or is there something missing? Please tell me I don't have to update any hardware.
emulator: WARNING: Requested RAM size of 1536MB is too large for your environment, and is reduced to 1152MB.
emulator: device fd:592
HAX is not working and emulator runs in emulation mode
emulator: The memory needed by this VM exceeds the driver limit.
Cannot set up guest memory 'pc.ram': Invalid argument
Error accepting connection, aborting

Well i think you have 3 options here
Number 1
Use Genymotion
Number 2
Start testing on a real android device
Number 3 (i like this more)
Edit the AVD that you are using and set the memory to 512 MB
will reducing to 800 mb help? If so? How do I do that?
First step
Window -> Android Virtual Device Manager
Second Step
Select your device and click Edit button in right part of window
Third Step
In Memory Options secton find RAM parameter and set it to 512. Click OK for saving option
Rerun the emulator and it should work.
Good luck

Click on AVD manager,it will open already created avd. Click on edit AVD icon which as right side (second last). after that click on show advance setting. from here you can reduce size of RAM to 512 MB. Good Luck

Related

Android Emulator never finishes loading

I'm trying to launch a project in Android Studio using the Android Virtual Device Manager. At first the Android Emulator pops up with a Google icon and a loading bar, but it never actually finishes loading.
I also tried running the program without using the Device Manager and just clicking the 'Run' button. A, in which case I get this:
"Instant run requires that the platform corresponding to your target device (Android P Preview) is installed."
And if I click on "Install and continue" it says:
"All packages are not available for download!
The following packages are not available:
- Package id Platforms;android-P"
These are all the versions I have installed:
Instant run requires that the platform corresponding to your target device (Android P Preview) is installed.As you can see, the Android P Preview is actually installed. Although it says on the right it's "Partially installed" there doesn't seem to be any update option.
I have no idea why this won't work.
Please help.
This seems like a memory issue with your AVD. Newer API emulator images may require at least 1 or 2GB of RAM in the AVD's settings, and a larger VM heap size.
Setting RAM too low will cause the emulator to either fail to start, or start but never end booting. Use at least 1024 or 2048 MB for API26 images.
Setting RAM to a value higher than your system’s capacity will fail to start the emulator
Emulator’s first boot seems to require more RAM. If you create an emulator with 512 MB for the first time, it might never end booting and hang. If you create it with 2048 MB, start it up, then close it, you may be able to run it with as little as 512 MB from now on, to a certain extent. All RAM values here refer to the AVD’s assigned RAM
Taken from this blog post. Also check out there if you need HAXM or Hypervisor for hardware acceleration.

android studio emulator loading but not working

I have used Eclipse to write apps for android multiple times without issue but I am now trying the new Android Studio which I like but here is my problem.
When I run the app I pick my AVD and then tell it to start. The emulator starts loading and then says paired. Then it starts telling me to swipe up and left and right to display and remove cards. Then it says to put hand on screen to dim the screen, ok well I'm on a MacBook Pro so that don't work I swipe to get past that part sometime I can others I can't. Next it says to touch the clock and say some words which also can't do on my Mac, and that is where the emulator stay it never goes to a home screen and it does this no matter what AVD I choose. How can I get the Emulator to just plain open to the home screen like it should.
Thanks for any help.
In your AVD Manager, edit your AVD and make sure your Target is "Android L" and not "Android X.XW". The "W" stands for "wear" and that is causing your issue.
Alright I figured it out. I remember having a similar problem recently when I was taking an android development class for college using eclipse and sure enough that was it.
So here was the solution eclipse gave same problem. for some reason if you have caught exemptions such as hard coding a string etc. the emulator will not run till you ignore these exemptions or fix every last ! mark in your code. Once you do this the emulator will load and run properly.
I also had the same problem with my AVD. The Android Emulator window just used to pop us and the green bars flowed infinitely. After lots of trial and error I arrived at a solution for my problem. the problem was with the Heap size and the RAM size.
Initially the default heap size was 128 MB and RAM was 1563 , I just changed the heap size to 512 MB and reduced the RAM size( high RAM was making my PC run slow) also I enabled hardware acceleration. And Yipeee, it worked.

Android Virtual Device camera is not working despite I have chosen webcam as a source

I have Acer Aspire V3-571G which has integrated web camera in it. It is working I checked it.
1.In AVD setup I have chose Webcam0 as a source.
2.When started an emulator it asked me for selecting the source I chose hdWebCam.
3.When started camera in the emulator I still get werid emulated(?) screen. How to fix it?
Images in correct order below.
I was getting the same results as you until I changed the processor type to Intel, from MIPS. My webcam came on for a few seconds but then the camera app crashed in the emulator. I am using a Mac. You should try changing the processor type.
Try to change the value of VM heap in memory option for this one. Like this:
VM heap : 32

Android 4.0.3 emulator crashes: Failed to allocate memory: 8

The problem started when I changed the skin built-in display setting to WXGA720.
Then everytime I'm trying to run the emulator it says the following message:
Starting emulator for AVD 'android403'
Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I already tried to lower down the RAM size to 800 MB and then 512 MB (or even 256) but it didn't work either...
I don't know what to do...
Here's a screenshot of the emulator settings window:
Thanx upfront.
I do sometimes have the same problem. Maybe my solution works for you as well: Instead of choosing the WXGA720 skin preset, manually set the resolution to 720*1280, and manually set the RAM to 768 or even 512.
Seems stupid, but it makes a difference if the skin preset is uses or a manual resolution configuration.
I had the same problem. I have set the resolution manually to 720 X 1280. Set the RAM size as 128MB and SSD to 16 MB. The app came up without any problems after that
This may sound silly, but I resolved the issue by adding "MB" after the RAM setting, changing (for example) 1024 to 1024MB.
I figured it out. The problem was in the amount of ram I had specified for the virtual machine, and it was 1024MB, now I have 512MB and it is ok. enjoy ;)
I also faced the same problem for x86 emulator for android 4.0.3. This problems happens to me only when i try to launch emulator from eclipse. But works fine when i launched the emulator from command line. Try to launch the emulator from command line.
Go to android tool directory and use "emulator -avd " to launch your emulator.
I had the same problem, trying to emulate the Galaxy S3. Setting the resolution to 720 x 1280 and dropping ram from 1024 to 700 worked for me. Could't get it to work at all on the built in wxga720 settings.
I was with the same problem today, but I manage how to solve it ( at least for me, because I was doing it in the wrong way), hope that it can be usefull for you too.
I was trying to change de Device RAM memory direct by Eclipse via Android Virtual Device Manager. I don't know why, but this changes does not affect the "hardware.ini" file that is present in : \android-sdk\platforms\android-16\skins\WXGA800-7in , for example.
To change the device RAM, or just to add MB you need to change this file.

Android Emulator Freezing on Load Screen

I am beginning android development using the latest versions of the android SDK and eclipse. I have followed the Hello Android Tutorial
and used every combination of targets available but the Emulator freezes on the load screen with the flashing "android" title.
I have checked the other related question and DID wait about 15 minutes. but still no change. Any help with this would be great. Thanks.
I had a similar issue, and still do sometimes today. Have you tried deleting the AVD and then re-creating it?
Also try changing some of the AVD's values, give it more ram, larger SD card. You can do this through Window > Android SDK and AVD Manager > Edit the AVD, and then add values / modify the SD card size.
EDIT: Also - just for reference, I have a Intel Core i7 with 16gb of RAM and AVD's STILL take forever to load.
EDIT: Another handy thing to know is that if you check the "Snapshot" option when editing the AVD, it will save the last state and load that instead of a full [slow] boot. Kind of like putting your computer to sleep.
Adding values / modify the SD card size may be better .
Try not to close the Android Emulator , to avoid re-open .
Yah android emulator takes time to start up, but it should start within 2-3 mins. Check your RAM and processor. The RAM must be atleast 1GB (preferably more) to speed up loading emulator.

Categories

Resources