8

I've spent whole day trying all methods found in multiple questions here on stackoverflow and dozens of google results (short summary):

  • Restart computer
  • Delete and recreate AVD
  • Change AVDs Graphic to Software (both in the AVD manager and directly in file)
  • Reinstall Emulator in SDK manager (all possible ways - update, delete and reinstall, reinstall on demand when starting AVD)
  • Reinstall HAXM
  • Reinstall Android studio
  • Check all Android versions in SDK manager
  • Start AVD from command line (this method is important for this post)
  • probably something more
  • ... and this everything several times in different order and combinations

Then I've found this comment reply under (this) video on youtube:

I managed to fix the issue after looking for it for 5 hours. There is no error message when I tried to run from the android studio. However, running the emulator the terminal will print the error message and this will help a lot. Run from terminal: /Users/hendrysetiadi/Library/Android/sdk/emulator/emulator emulator -avd Pixel_4_API_29 My error message is like below: emulator: Android emulator version 30.5.0.0 (build_id 7145572) (CL:N/A) dyld: Library not loaded: /System/Library/Frameworks/IOUSBHost.framework/Versions/A/IOUSBHost Referenced from: /Users/hendrysetiadi/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64 Reason: image not found Abort trap: 6 I managed to get the IOUSBHost.framework from my friend laptop and then upload it to google drive (in zip format) I follow the steps in here https://apple.stackexchange.com/questions/300222/accidentally-deleted-a-system-framework-macos-screwed The steps are - restart mac and command+R to show recovery option, choose safari icon to launch safari in recovery mode - In safari, open the google drive link I have uploaded earlier, then download the zip file directly into /System/Library/Frameworks/ (it will automatically unzip) - restart the laptop. - Done

That was exactly the same error I got using command line method.

The problem is, that I do net have access to another computer running OSX - Mojave in my case. But I don't know if the os version is that important.

My question is: "Is anybody capable and willing to provide the file IOUSBHost.framework found in /System/Library/Frameworks/ from OSX (Mojave at best) and post the link here?" Preferably in zip, but I can manage this myself.

I will immediately test the method and if it will work I will host the file myself (to maintain availability and to free the poster`s resources) and create solution answer here.

Thank you

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Uli
  • 539
  • 3
  • 11
  • Happened to me today, upgrade to Big Sur helped. – Eugene Mar 21 '21 at 15:20
  • @Eugene I suppose it helps. Unfortunatelly, I have computer full of specialized programs, sometimes quite expensive programs which I need and I am not sure they are compatible with Catalina, not to mention Big Sur. That is not solution for me at this moment. – Uli Mar 21 '21 at 19:49
  • 1
    [This answer](https://stackoverflow.com/a/67286171/3572648) fixed my issue on macOS Big Sur 11.3, and Android Studio 4.1.3 – sanya5791 Apr 28 '21 at 01:56

5 Answers5

10

EDIT:

After update to Android Emulator 30.5.4.0 the framework is no longer required. Google has probably fixed that.


After further research and thanks to comments here, and especially answer by Don Pato it became clear that after Android emulator update to version 30.5.3.0 it starts to show given error on OSX Mojave and older because of missing framework.

There are 2 obvious solutions for this situation + this one:

  1. Update OS
  2. Downgrade Android emulator (along with Android studio itself)
  3. This solution

The first solution can be unable due to some other software compatibility and the second can be impractical because older emulator is able to run Android API 29 max.

Thanks to original author (Hendry Setiadi) of mentioned Youtube comment who provided required file (he is the hero here), the problem can be solved avoiding 2 previous options. I had to change a little his steps, because I could not directly download the file in Safari in recovery mode due to "disk out of space" error.

The solution process:

  1. Download missing framework from following link: https://www.dropbox.com/s/i9bzzw5sr0s7e81/IOUSBHost.framework.zip?dl=0
  2. Unizp
  3. Now it is necessary co get the file IOUSBHost.framework to /System/Library/Frameworks which is system read-only dir. Who knows how to do it, can stop reading and just do it. I did it by following steps - some of them might be unnecessary.
  4. Restart to recovery with Cmd+R and in Utilities start terminal to disable System Integrity Protection with csrutil disable
  5. Reboot to system and mount system writable by putting in terminal sudo mount -uw /
  6. Now you can copy the file - I did it in Finder (mac user password was required)
  7. Don't forget to turn SIP on again in recovery by csrutil enable

Start your AVD!

Uli
  • 539
  • 3
  • 11
  • Thanks, it works for me. I spent a whole day trying to figure out why avd got killed! – Hellious Mar 23 '21 at 08:35
  • Works, I just had to drag and drop into the Frameworks folder. Mind you, I am running a Hackintosh, which might be the reason I only had to enter my admin password. – Sean Blahovici Mar 26 '21 at 18:09
  • 1
    Thanks. I added a bounty to this question. If in 7 days a better answer is not available I will try your approach. Honestly I am hesitant to download some framework dylib from a dropbox, but I might try it if nothing better works – lurscher Mar 26 '21 at 21:04
3

Google is working on this bug. The next version of the emulator will not have the dependency on that Framework. There is a beta of 36 available here:

https://issuetracker.google.com/issues/183218284

Jeff Mikels
  • 713
  • 1
  • 6
  • 14
  • Thank you, I will edit the solution as soon as stable version is available and proven as working. Anyway, it is quite fail from Google, if I imagine sum of all hours people had spent facing this issue. – Uli Mar 25 '21 at 09:11
  • indeed. Just because Apple policy is to drop support and even block development on older OS versions to push their obsolescence schedule on everyone, doesn't mean that Google must play ball with them – lurscher Mar 26 '21 at 21:00
  • 1
    I want to mention that simply upgrading the emulator didn't work for me. I had to unselect and remove it and then re-install. Now I'm up and running with Studio 4.2.1 and emulator 30.6.5 :) – siax Jun 25 '21 at 08:45
2

I am getting the same error as you. Nothing from the proposed solution worked. I've tried out all that you did. And so far, it seems that the only solution is to upgrade our Macs at least to Catalina... Or downgrade everything... which seems to be not the easiest way.

In macOS 10.15 Catalina, Apple has introduced a new framework to access USB devices in user mode, the IOUSBHost framework.

you can read more here:

hope this brings you some light too ;)

Don Pato
  • 41
  • 3
  • 1
    I see. So this framework is not available in older versions of OSX (10.14 and lower). So it has to be from Catalina. I have some idea and if it will work I would be able to provide answer. Thank you for this answer. – Uli Mar 22 '21 at 09:04
  • For the time being, I downgraded to an older version of the emulator, 30.2.6. You need to start the emulator from the command line, Android Studio doesn't pick it up. I'd keep the defunct version around, in case you want to use the new emulator image wizard. This link points to 30.2.6: [dl.google.com/android/repository/emulator-darwin-6962233.zip](https://dl.google.com/android/repository/emulator-darwin-6962233.zip) – Matt Mar 22 '21 at 11:56
  • @Matt Using the solution here, you can safely upgrade back to latest version again. – Uli Mar 23 '21 at 21:24
  • @Uli Thank you for figuring this out and documenting it! The team at Google is already working on a fix. I've downloaded the IOUSBHost framework as a precaution if it should happen again or if they eventually change their system requirements. https://issuetracker.google.com/issues/183218284 – Matt Mar 24 '21 at 22:12
1

I am using High Sierra OSx 10.13.6.

I am getting the same error message on the command line since the emulator upgrade to 3.5.3.0

~/Library/Android/sdk/emulator/emulator -avd Pixel_XL_API_30 emulator: Android emulator version 30.5.3.0 (build_id 7196367) (CL:N/A) dyld: Library not loaded: /System/Library/Frameworks/IOUSBHost.framework/Versions/A/IOUSBHost Referenced from: /Users/user/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64 Reason: image not found Abort trap: 6

Will try downloading the given zip file and attempt the fix. thanks Jeff.

Leo
  • 11
  • 3
  • Let us know, if this works also on this older OS. – Uli Mar 25 '21 at 19:47
  • Thanks. I added a bounty to this question. If in 7 days a better answer is not available I might try your approach. I am also on High Sierra and have no plans to upgrade further, due to other essential software that does not support Mojave or above – lurscher Mar 26 '21 at 21:08
1

I too faced this issue. After updating my Android Studio to 4.1.3, emulators stopped running. I did everything possible to fix this. Found that for few people, upgrading their MacOS to big sur fixed it. I downloaded big-sur, but then while installing, it asked to free up 25GB from the device, which was not possible and hence could not install big-sur too.

Ultimately, after updating to Android Emulator 30.5.4.0, it fixed the issue. Did not need to do anything else. It seems google has fixed it in the latest Android Emulator release.

Abhishek Kumar
  • 4,532
  • 5
  • 31
  • 53