Cannot create android emulator because image fails to download - android-studio

I tried to download an android image in android studio but it keeps giving me this error.

This is due to slow internet speed. The error is Read Time out. Try to stop everything else on the internet then again download it or use 3g or 4g data package on your sim, connect your system through the hotspot and then download, it will give you a great speed.

Related

BlueScreen after Run emulator android studio

When im run android studio, or run emulator for android studio with manually or with cmd, always get bluescreen.
it say "your pc ran into problem and needs to restart. we're just collecting some error info, and then we'll restart for you"
Stop code: IRQL Not Less or Equal
how can i fix it ?
im trying download another emulator and following tutorial on youtube, but it didn't work
It depends on various factor,
I happened to get this issue because of my old PC with Lesser RAM size(4GB) and to rectify it, I connected my Android phone to PC for debugging/running apps from Android Studio.
You need to enable USB Debugging in your phone for that purpose.
NOTE:
You can view this blog post I made, which addresses the same issue.
https://whysurfswim.com/2015/07/11/sick-of-your-avd-theres-a-alternate-for-it/
I had almost same problem. When I tried to install my app in emulator(Ram 8gb), my emulator crashes but kept running in background. As a result, I was unable to shut down my pc and have to disconnect power for shutting down.
use your phone for debugging your app. you can connect your phone using wifi. link here
Sometimes it happens beacause of outdated drivers, try updating your drivers to latest version, and update the windows 10 to latest version. Also try by deleteing your current emulator device and create new device by enabling software renderer. For lower end pcs like yours I would recommend to use real device instead of emulators ans use ssds for better performances.

Not able to view or save the file using device file explorer.when i try to open or save i got error as shown in image

see the image for error info
Unable to access the file from my device using android's device explorer getting a error.
I solved it!!!. Windows defender was the culprit I just turned off antivirus it's working fine now. But I won't recommend Turing off antivirus forever you can just add launcher of Android studio (studio64) in exclude list of your antivirus.

Vuzix sdk loading error cvc-elt.1.a cannot find the declaration of element 'sdk: sdk-addon'

I am trying to load the SDK for Vuzix through the SDK manager in Android Studio but for some reason it will not display the downloads in 'SDK platforms' and 'SDK tools'.
In the 'SDK update sites' tab next to the Vuzix link I added there is a red exclamation point that displays " cvc-elt.1.a cannot find the declaration of element 'sdk: sdk-addon' " when hovered over.
I am new to SDK's and have no idea what to do for this error. I've downloaded the android SDK's and sources for 26,25,24, and 23 thinking it could help but the error still shows up.
I still don't know what the error means but I solved it by connecting to my hotspot instead of my work network.
So my guess is it was a firewall issue or something, if anyone else has this error.
This means that the parser does not know the namespace. I tried it on Win7 and android studio 2.3.3 with the same result.
I tried it without the namespace or running android studio with oracle sdk. Both failed.
At the moment I try to run it on a virtual linux machine. Android Studio 2.3.3 will parse the addon xml file and download the files.
On Win7 I installed them manually, but they were not really integrated into to system and I stucked when I wanted to use the barcode SDK. maybe I am able some day to add simply this jar lib -
On a first look using linux seems to be the solution. But than I run into problems with the case sensitve file system. The vuzix SDK seems to need a linux system on a case insensitve file system.
*facepalm* and I am quite sure that i will fail at all. On linux a simple GUI compiles only against API 26 without errors.

Android Studio emulator keeps freezing, crashing, and is not responding at all

I'm a starting Android development and have recently ran into some problems. I don't know whether it is my hardware or if it's Android Studio but the emulator keeps freezing or is not responding.
The first 2 days Android Studio was running fine. However, after that it cannot run my apps. I reinstalled Android Studio and it worked for one day, but now even if I reinstall it, it won't run any apps and even Android Studio itself would occasionally freeze and I will have to restart it.
The emulator either does this or does not even turn on:
it won't even respond when I click on anything on the emulator
Here is a break down of what's been happening.
Day 1: works fine.
Day 2: Android Studio freezes multiple times when I launch the emulator. Emulator unresponsive to clicks. I uninstall Android Studio thrn install it again. After reinstallation it works 100% again with the same app
Day 3: emulator unresponsive, freezes. Menu bottons such as rotate screen, back etc. unresponsive.
Day 4: same as day 3. Uninstall Android, reinstall. Unresponsive.
You can try changing this line of code System.out.println(userinput1); to Log.d(MainActivity.class.getSimpleName(), userinput1) because on emulator system.out.println() automatically redirects to logcat but sometimes not.
This problem may arise due to low ram size, android studio works fine with 8GB Ram.Or try to config emulator properly. Let me know if problem continues.
I would suggest that import just specific address of class not the whole package or as bundle.
With
import java.util.*;
all classes of java.util package is imported.
The problem might be that, your hardware might be overwhelmed.
I don't think anything is wrong with your code. What is your system configuration? Does other applications work on emulator work? Can you post you
post your logcat?
PS: I know it should have been a comment. But I don't have permissions, sorry.
Problem and solution
Same problem, unusable for serious testing, whole system locking up regularly (Linux Mint Vera | 16GB-RAM | Nvidia GP106 [GeForce GTX 1060 3GB] -- worked fine on Windows 7, exact same hardware (although hard drive config has changed slightly, might need to double-check the OS drive is connected port0 on motherboard in case of performance impact).
It's ironic that Android being Linux based, struggles to run in a Linux env xD.
Tried different:
Linux APIs
Emulator Phone Models
Phone RAM specs, processor specs, etc
( All different graphics modes (both in native A-Studio emulator and using the apt install-google-emulator option for vanilla standalone (old school) version. Old school version runs better (standalone version).
Checked all microcode updates and drivers are in order. (Using Nvidia GP106 [GeForce GTX 1060 3GB]
System is up to date (apt)
Found the best options:
Performance Better: Restart Android Emulated Device with 'Cold Boot' option specified
or
Use Diff Emulator: Virtual Machine Manager / Virsh (KVM-QEMU)
or
Use Physical Device: With Android 11+ you can wifi pair.
With devices APIs lower than 11, there is no Wi-Fi pair feature so I found solution was to install termux on the handset I wanted to use for app testing, which gave me a standardish shell with apt pkg manager -- then I could install sshd and connect to dev-PC with portforward i.e
$ SSH from Phone to PC with: ssh -R 4444:127.0.0.1:5555 ubuntu#192.168.1.20
$ SSH from PC to Phone with: ssh -L 4444:127.0.0.1:5555 ubuntu#192.168.1.20
(The exact command may vary, written from memory as quick guide to get you moving right direction thought ports are correct, syntax may need adjusting and of course, the username#hostIP needs setting to your you-login#your-computers--LAN-IP).
Once an SSH connection has been established, which you can check using something like
$ ss -tulpan | grep 4444
or
$ netstat -tulpan | grep 4444
Once confirmed established, you need to fire up adb to connect to the now available Android adb service that we forwarded from the handset into the dev-PC by running the command (also make sure you have USB debugging enabled on the handset before doing this);
On dev-PC run;
$ adb connect 127.0.0.1:4444
It should say 'CONNECTED'.
Then to double check, run:
$ adb devices
Emulator should show up in Android Studio Device Manager. Give it a few minutes and Android Studio will pick it up!
I can't remember the specific reason I needed to do it this way as opposed to just connecting with a USB cable. I think I was doing some mad routed setup. But there we have it!
I found using a physical device to be the ultimate performance solution but is of course a bulky arrangement.
Update
Increasing memory available to Android Studio and the VM made big difference (I have 16gb RAM).
Android Studio > Help > Change Memory Settings (2048 -> 4096)
Android Studio > Help > Edit Custom VM Options > add/replace-->
(-Xmx4096m
(-Xmx4096m
(Then finally added extra config to Gradle script to allow extra memory but I don't think that would have an impact on the slow running issue as was entire emulator crumbling not just the app.)
In gradle.properties, replace order.gradle.jvmargs.... (with)
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Finally, restart Android / Emulator and remember to do a COLD BOOT on your emulator device.

AVD Emulator stuck on loading screen in Android Studio

I decided to try Android Studio 2.0 having used Eclipse in the past but I'm having considerable difficulty getting the AVD to load correctly. I've done quite a bit of googling and research into the problem, both here on SO and Google.So far nothing has worked.
The emulator simply hangs on the android load-up screen ever time I try to run it. I've seen it advised to use Genymotion but I would first prefer to resolve the issue natively in Android Studio to feel confident going forward using the IDE for building projects.
Here's what I've tried:
Complete reinstall of Android, SDK and SDK Tools
Install and configure of Intel x86 accelerator
Lowered the RAM amount to 512 in AVD settings
Multiple attempts at deleting and recreating AVD's
Tried creating different AVD phone models(Nexus One,Nexus 5x etc.)
Resetting ADB in AVD Monitor Tool
Starting ADB server from terminal
Restarting Android Studio multiple times after changes
Running SDK/SDK Tools updates several times
Made sure the SDK path is correct
These are the majority of the "solutions" I found either on other similar SO questions or by googling none of which has resolved the problem.
When I run the emulator currently it displays the following in the run window:
/Users/<username>/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_23
Warning: requested ram_size 1024M too big, reduced to 512M
emulator: WARNING: Increasing RAM size to 1024MB
emulator: WARNING: VM heap size set below hardware specified minimum of 228MB
emulator: WARNING: Setting VM heap size to 256MB
Hax is enabled
Hax ram_size 0x20000000
HAX is working and emulator runs in fast virt mode.
console on port 5554, ADB on port 5555
The emulator shows up fine in the Android AVD Monitor devices pane and even appears to go through the entire booting process on the emulator screen itself but never gets to the Android home screen.
Also, Logcat seems to be looping continuously through dozens of errors and warnings, which don't offer any clear indication of what the issue might be or direction of how to resolve it.
I feel like I've exhausted every idea and not sure how to move forward.Just for the record, I am running El Capitan 10.9.2 with a 2.4gh Intel Core 2 Duo and 4gb ram.It's not the fastest machine for sure but should be capable of running Android Studio and the emulator.
Any help or guidance resolving this problem is gratefully appreciated!
For me this worked: in AVD(Tools->AVD) click on the small arrow for desired emulator then click on "Wipe data".
After that, it successfully started - passed the android logo screen - although a bit slowly.
You have two thing:
You should Increase your ADB emulator Heap to the minimum required.
in your case: 512M
into your AVD Manager:
Click Edit on your Emulator
"Show Advanced Settings" at the bottom
Go to: "Memory and Storage"
Edit the VM heap value to 512 MB
Finished
Image:
You can Wipe data to your Emulator. here is an exemple website
At one point my laptop hit a kernel panic and restarted while running an active AVD emulator session. When attempting to restart the emulator, the emulated device (Pixel 3) stayed stuck on the startup splash logo screen.
Fix steps:
Stop hung emulator session.
rm ~/.android/avd/name_of_emulated_device.avd/*.lock
rm ~/.android/avd/name_of_emulated_device.avd/*.qcow2
Restarting the emulated AVD should now be successful.
Windows equivalent for ~/.android should be C:\Users\.android, but I can't confirm this myself.
Note: You will likely lose any additionally installed apps and current work that was on the AVD.
Unfortunately, increasing the heap size didn't help in my case. The virtual device was actually running fine before with the previous amount of heap.
What I eventually ended up doing was just creating a new virtual device through the AVD manager leaving most of the fields the default value. The new device ran fine and booted up as expected and was able to run my app. It's possible something in my first virtual device became corrupted.
I had the same problem. I'm running El Capitan 10.11.5 with a 2.0GHz Intel Core 2 Duo and 8GB RAM, Android Studio 1.5.1.
After upgrading to Intel x86 Emulator Accelerator (HAXM Installer), rev 6.1.1 and deleting my API 14 SDK and related files, the newly installed API 23's Google APIs Intel x86 Atom System Image would not get past the Android logo screen.
After much trial & error, the Intel x86 Atom System Image (not Google APIs Intel x86 Atom System Image) for API 15 finally loaded the home screen on the emulator after ~ 8 min and one android system crash.
Will try the Intel x86 Atom System Image for API 23 later. Hope that helps.
I had the same problem and none of the steps listed here helped me, either.
But since the solution that worked for me was not mentioned here yet, I thought it might help you or one of the others finding this thread:
What did work for me was disabling certain settings in my Avast Antivirus as proposed by the Android studio troubleshooting page here.
My version of Avast did not have the setting "Use nested virtualization when available", however just turning off "Enable Hardware assisted virtualization" (note: restart is required for it to take effect) solved the problem just fine.
So if you are using Avast or another Antivirus which manipulates virtualization, be sure to look through the correspondent settings.
I had experienced same problem, What I did was, I clicked on the drop down in the actions column, then clicked on wipe Data, and that resolved it for me on ubuntu 20.04
I had this problem and running as admin fixed this (drove me crazy).
Hope this works for you too tried some many fixes.
What worked for me?
Create new project with same configs.
And start your old emulators in it.
What did not work?
Wiping data.
Increasing Heap size.
Creating new virtual device.
I also had the same problem with my AVD. 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.
It's very easy to fix all you need to do is go in AVD Manager click on the small arrow on most right side of the screen beside the edit icon. Click that small arrow and select wipe data.
Now when you'll start your AVD it will restart and work properly.

Resources