Git Product home page Git Product logo

android-emulator-m1-preview's Introduction

Note: No longer needed

Support for downloading the M1-based emulator was added to SDK Manager, so it's not necessary to go to the Github releases page to download a standalone .app anymore. In AVD Manager go to the Other Images tab as by default it doesn't show the ARM64 images.

Android Emulator M1 Preview

This is a preview of some basic Android emulation functionality on the M1. There are still many issues, but apps work at a basic level. To be updated soon with more fixes. The release tag corresponds to this commit: https://android.googlesource.com/platform/external/qemu/+/aca144a9e9264b11c2d729096af90d695d01455d

Known issues

  • Webview doesn't work in the AOSP version, but works in the Google APIs version preview v3. However, Chrome doesn't work.
  • No device skins
  • Video codecs not working
  • 32 bit ARM apps won't work
  • Graphical glitches in some Vulkan apps
  • Popup on startup about not being able to find the ADB path (ADB will still notice the emulator if you have it installed though)
  • When building, it may be faster to start then cancel the Python triggered build and then reissue ninja -C objs install/strip versus letting the Python triggered build finish.

How to use

This only works on M1 Apple Silicon Macs. M1 (or equivalently capable) SoCs are required; note that this does not work on DTKs as they do not support ARM64 on ARM64 hardware virtualization via Hypevisor.framework.

Go to the Github releases page, download a .dmg, drag to the Applications folder, and run. You'll first need to right click the app icon and select Open and then skip past the developer identity verification step (we are working on providing official identity info). The first few times it starts up it will take a while to show up, but subsequent launches will be faster.

If you've installed Android Studio and Android SDK and adb is available, the emulator should be visible from Studio and work (deploy built apps, debug apps, etc).

How to configure

Edit /Applications/Android\ Emulator.app/Contents/MacOS/aosp-master-arm64-v8a/config.ini. Some notable options:

  • disk.dataPartition.size: size of userdata. When reconfiguring, you'll also need to delete all userdata*.img files in that directory.
  • fastboot.forceColdBoot,fastboot.forceFastBoot: whether to enable snapshots. Current default is snapshots disabled. Set fastboot.forceColdBoot=no,fastboot.forceFastBoot=yes to enable snapshots.
  • hw.lcd.density: Virtual display DPI.
  • hw.lcd.width,hw.lcd.height: Virtual display dimensions.
  • hw.ramSize: RAM limit for the guest. (2GB minimum)

How to wipe data

Remove all userdata*.img files in /Applications/Android\ Emulator.app/Contents/MacOS/aosp-master-arm64-v8a/.

How to build your own emulator

Building the engine

The emulator source code lives (here), but there are a bunch of other dependencies to download, so we use repo.

To build, first make sure you have Xcode and Xcode command line tools installed, and that you have Chromium depot_tools in your PATH (link). Then:

mkdir emu
cd emu
repo init -u https://android.googlesource.com/platform/external/qemu --depth=1
repo sync -qcj 4
cd external/qemu
python android/build/python/cmake.py --target=darwin_aarch64

Note that canceling the python based build after it gets going and issuing just ninja -C objs install/strip may be faster.

The built artifacts are in /path/to/external/qemu/objs/distribution/emulator. They should be automatically signed. However, the binaries in objs/ are not; to sign them, issue ./sign-objs-binaries.sh. Note that this can only be done after ninja -C objs install/strip is successful.

Building the system image

The system image is built from AOSP master sdk_phone_arm64 with a few modifications. Ideally, let's be on a Linux host when building the system image---the build is relatively untested on M1 systems, and at least, we need to create a separate case sensitive partition for the AOSP repo. Assuming you're on Linux:

mkdir aosp-master
cd aosp-master
repo init -u https://android.googlesource.com/platform/manifest -b master --depth=1
repo sync -qcj 4

We first need to make an edit to remove all 32 bit support. Patch this change: link to build/make/target/board/emulator_arm64/BoardConfig.mk. Then:

source build/envsetup.sh
lunch sdk_phone_arm64-userdebug
make -j12

After that's done, we can use this script to package up the system image for use in /Applications/Android\ Emulator.app/Contents/MacOS/aosp-master-arm64-v8a/. Assuming you're still in the Android build environment:

echo $ANDROID_PRODUCT_OUT
export ZIPPED_NAME=$1
mkdir -p $ZIPPED_NAME/files
cd $ZIPPED_NAME/files
cp $ANDROID_PRODUCT_OUT/system-qemu.img system.img
cp $ANDROID_PRODUCT_OUT/vendor.img vendor.img
cp $ANDROID_PRODUCT_OUT/ramdisk.img ramdisk.img
cp $ANDROID_PRODUCT_OUT/ramdisk.img ramdisk.img
if [ -f $ANDROID_PRODUCT_OUT/kernel-ranchu-64 ]; then
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu-64 kernel-ranchu-64
else
    cp $ANDROID_PRODUCT_OUT/kernel-ranchu kernel-ranchu
fi;
cp -r $ANDROID_PRODUCT_OUT/data .
cp -r $ANDROID_PRODUCT_OUT/advancedFeatures.ini advancedFeatures.ini
cp -r $ANDROID_PRODUCT_OUT/userdata.img .
cp -r $ANDROID_PRODUCT_OUT/encryptionkey.img .
cp -r $ANDROID_PRODUCT_OUT/build.prop .
mkdir system
cp -r $ANDROID_PRODUCT_OUT/build.prop system/build.prop
cp -r $ANDROID_PRODUCT_OUT/VerifiedBootParams.textproto .
cp -r $ANDROID_PRODUCT_OUT/source.properties .

cd ..
zip -1rq $ZIPPED_NAME.zip files
ls -l $ZIPPED_NAME.zip

Then, $ZIPPED_NAME.zip can be sent over to the M1 and the contents of its files/ can be coped over into /Applications/Android\ Emulator.app/Contents/MacOS/aosp-master-arm64-v8a/.

android-emulator-m1-preview's People

Contributors

741g avatar berkesonmez avatar coltonidle avatar lfy avatar mahdyar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-emulator-m1-preview's Issues

安装完成之后一直停顿在这块

模拟器安装完成之后一直停顿在这里,打不开。
android studio 自带的avd mannger 里面的other img 也没有模拟器,我安装的时候一直显示我的cpu不支持这个模拟器,你们遇到了相同的问题吗

Guides on making it work without bugs

Hi! Can you please share how can I help you to make it work without bugs? I am particularly interested in making video codecs work cause I need videoView to work in android. Thank you in advance.

ARCore support

I was able to install Google Play Services for AR on emulator, but when new Session is created UnavailableDeviceNotCompatibleException is thrown. Is there a plan to support running AR apps?

APK failed to install

The APK failed to install.
Error: INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113

I'm a developer of server ,how can i fix it without changing apk package 😭

OpenGL incompatibility?

I had the preview successfully launch, installed an app, and even created a custom AVD that flawlessly functioned at 5120x2880 resolution. After conducting a few tests after changing settings in attempts to optimize performance, I changed a setting relating to OpenGL in the emulator itself ( the menu that displays upon clicking the 3 dots at the bottom of the bar on the right ). Now, my mac refuses to boot any AVDs. I cannot change it back, as the menu to change it is only accessible after successfully launching the AVD. Upon attempting to launch an instance, the AVD loads and shows up in the activity monitor, however no window appears. Followed up with a "unresponsive app" notification. I've tried a full reset of Android Studio and cleared all files related to it, however it still remains unresponsive. I might be confused on what caused the issue, although I believe that changing it's rendering options creates an issue.

Expo App constantly crashes

Having some issues running an Expo app on the simulator. It might boot correctly the first time and work for around a minute or so. It will then crash and all subsequent attempts to run the Expo app cause the app to immediately crash.

Any guidance would be awesome, thanks.

Debugging not working, only release?

Using Visual Studio for Mac to work on a Xamarin.Forms project.
When debugging, I get a Deployment failed message, but release works fine - any ideas?

how can I make it work with IDEA with Android plugins?

Hi, the emulator works well on Android Studio on M1, but I prefer to use IntelliJ IDEA with Android plugins at this time just because the IDEA runs natively on my M1 Macbook Air.

Is there any help on how to make IDEA and the preview emulator works together ?

Thanks.

No Google Play Store

There is no google play store, so we cannot test for google maps etc.

How to install play store in emulator.

How to get it in Android Studio SDK Manager?

I noticed this sentence in the README

  • Support for downloading the M1-based emulator was added to SDK Manager, so it's not necessary to go to the Github releases page to download a standalone .app anymore. In AVD Manager go to the Other Images tab as by default it doesn't show the ARM64 images.

I downloaded Android Studio but It can only be translated by Rosetta.
And when I try to install AVD in Android Studio , It will prompt "The device does not support VT-x"

Screenshot creates transparent png

When tapping on the screenshot camera icon or using the hotkey (Command+S) the emulator produces a transparent PNG with no content. I think it's producing it at the device size.

See the result:
image

Can provide more detail if required.

Expo does not start

Expo run adroid was able to install expo and build successfully but i app on emulator doesnt open

How to launch a headless emulator

Have anyone tried launching a headless emulator? I failed to launch a headless emulator as the following.

$ emulator -avd AndroidS001 -no-window
emulator: Android emulator version 30.3.5.0 (build_id 7036990) (CL:N/A)
emulator: INFO: ignore sdcard for arm at api level >= 30
handleCpuAcceleration: feature check for hvf
emulator: feeding guest with passive gps data, in headless mode
cannot add library /usr/local/Caskroom/android-sdk/4333796/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
cannot add library /usr/local/Caskroom/android-sdk/4333796/emulator/lib64/vulkan/libvulkan.dylib: failed
EglOsGlLibrary: Could not open GL library libGLESv2.dylib [dlopen(libGLESv2.dylib, 2): no suitable image found.  Did find:
	/usr/local/Caskroom/android-sdk/4333796/emulator/lib64/gles_swiftshader/libGLESv2.dylib: code signature in (/usr/local/Caskroom/android-sdk/4333796/emulator/lib64/gles_swiftshader/libGLESv2.]
EglOsEglDispatcher: Could not open EGL library libEGL.dylib [dlopen(libEGL.dylib, 2): no suitable image found.  Did find:
	/usr/local/Caskroom/android-sdk/4333796/emulator/lib64/gles_swiftshader/libEGL.dylib: code signature in (/usr/local/Caskroom/android-sdk/4333796/emulator/lib64/gles_swiftshader/libEGL.dylib) no]

I appreciate it if anyone has an idea to avoid this issue.

root the emulator

Hello, is there any way to root the emulator please? Thank you 👍

Setting ADB path causes spinning pinwheel of death

I hadn't downloaded ADB so it didn't detect a location, once I had downloaded just ADB I couldn't then manually select a location as it pinwheels and I have to kill the app. It isn't possible to simply type into the path box either.

M1 MacBook Air, 16GB / 512GB, macOS 11.1

Building from source fails

Using the instructions from here I get the following error.

$ repo init -u https://android.googlesource.com/platform/external/qemu --depth=1

Downloading Repo source from https://gerrit.googlesource.com/git-repo
remote: Finding sources: 100% (28/28)
remote: Total 28 (delta 8), reused 28 (delta 8)
Unpacking objects: 100% (28/28), done.
repo: Updating release signing keys to keyset ver 2.3
warning: gpg (GnuPG) is not available.
warning: Installing it is strongly encouraged.

Downloading manifest from https://android.googlesource.com/platform/external/qemu
remote: Counting objects: 2633, done        
remote: Finding sources: 100% (2633/2633)           
remote: Total 2633 (delta 500), reused 1725 (delta 500)        
Receiving objects: 100% (2633/2633), 6.06 MiB | 5.90 MiB/s, done.
Resolving deltas: 100% (500/500), done.
fatal: manifest 'default.xml' not available
fatal: manifest default.xml not found

removing the --depth=1 option does not help

repo is installed using homebrew:

repo --version
repo version v2.11.1
       (from https://gerrit.googlesource.com/git-repo)
       (Thu, 7 Jan 2021 22:44:53 +0000)
repo launcher version 2.12
       (from /opt/homebrew/bin/repo)
       (currently at 2.11.1)
repo User-Agent git-repo/2.11.1 (Darwin) git/2.24.3 (Apple Git-128) Python/3.9.1
git 2.24.3 (Apple Git-128)
git User-Agent git/2.24.3 (Apple Git-128) (Darwin) git-repo/2.11.1
Python 3.9.1 (default, Feb  4 2021, 18:52:38) 
[Clang 12.0.0 (clang-1200.0.32.29)]
OS Darwin 20.3.0 (Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101)

Front camera not working

when i setup webcam0 for front camera , the camera app is disappear from the app list, and the the macbook webcam is not used when in-app

No longer needed?

I started Android Studio 4.1.3 in macOS Big Sure 11.0.1 with new ARM cpu M1

It showed me CPU does not support VT-x, even ARM images have this issue.

When I created the AVD, the Arm64-v8a images did not worked at all, it showed me it needs to be work under the X86 system?

How could I use the AVD?

Android Studio is infinitely Waiting for device to come online .

When I run the app from android studio , emulator starts and run but the app cannot be installed because android studio is showing Waiting for device to come online message,I waited for an hour but its still showing same message ,emulator is completely started and working fine. I tried restarting abd server reinstalling emulator nothing is working . I tried the command adb devices the emulator is displayed offline.

How can I fix the adb device offline issue ?

Where is the emulator prebuilt source code?

I've send on twitter but seems that you're not active there anymore. I have a simple question:

https://android.googlesource.com/platform/prebuilts/android-emulator/+/refs/tags/android-11.0.0_r28/README says that the emulator prebuilt source is at
https://android.googlesource.com/platform/external/qemu/ but it hasn't been updated since 6 years ago.

Where is the emulator prebuilt source code?

I've found your changes on twitter: https://android.googlesource.com/platform/external/qemu/+/aca144a9e9264b11c2d729096af90d695d01455d and it looks like nothing happens on master for years, but other branches are ok. Which branch should I pick to build the same emulator prebuitl that comes in Android Studio?

I've take a look into the tree of your modifications and it looks like qemu code. I'm having a hard time trying to figure out which part of the code is for qemu and which is for the emulator prebuilt, which I think is the frontend for Google's patched qemu. I've compiled an Android build and it generated lots of .img files. Then if I run emulator (defined in build/endsetup.sh), somehow the emulator executable is able to load the .img files and insert them into Qemu in the right way. I'm looking for that logic

Integration in Android Studio only works for API level 30

We've setup Android Studio on an M1 Mac mini and could successfully install and start the emulator for API level 30. We can also create an AVD for API level 25, but that one doesn't start (the emulator stays black forever).

What's more important for us though is to have API level 29 – on level 30 there's an issue with accessing the /sdcard to get our screenshot tests running. On API level 29 there's no such issue, so we've always run our tests on that level. But an image on API level 29 seems not to be available (same for 28, 27, 26). Is there any plans to add more API levels soon?

How to disable side bar on emulator

스크린샷 2021-02-09 오후 3 34 07

I edited config.ini to hw.mainKeys=no
but I couldn't hide side bar

Is there any method to disable side menu bar to make emulator full screen ?

Thanks

How to install apps onto the emulator?

Trying to download an app onto the emulator but not having any luck with it. I've tried downloading an apk and dragging it onto the emulator but I get an error "Failed to start adb. Check settings to verify your chosen adb path is valid" and when I try to use Chrome to find the apk and download straight through the emulator it just crashes.

Resolution

How can i change to different resolutions

Change android version

I currently have installed the emulator, but it is with android 11. How can i change it to Android 9 (or any other version)?

Trying to upload pictures onto the emulator

Is there any way of uploading pictures onto the emulator, I tried dragging some png files and all other image extensions onto the emulator like with normal upload on other emulators and I got a small box with a warning in a yellow circle just saying "Could not copy" like this.
Screenshot 2021-03-09 at 01 43 06

Just wondering is there a way of doing this?

Could not automatically detect an ADB Binary

  • Installed latest release on Mac Mini M1 running 11.2.2
  • Android Studio 4.1.2 is installed and adb runs in terminal (path recognized)
  • Running latest release of preview, on open, get "Could not automatically detect an ADB binary.Some emulator func...'Use detected ADB location'
  • I cannot find that setting in my Android studio prefs
  • The preview appears to run however this error pops up, thought I should report it

How to connect with react native?

I am trying to run prerelease 3 for a react native project but it's not detecting the emulator. I have started the emulator.

Running command adb devices show this result

List of devices attached
emulator-5554	device

But when I run emulator -list-avds it's not showing there

Is there a time-planning available yet?

@Hey dev team,

do you habe a schedule for the development of the emulator?
Are there any targets for RCs or final versions?

What about android studio native? The guys from JetBrains released IntelliJ as universal binary.
Are they already working on a port of android studio?

Thank you so much...

Apps that require internet connection does not work

Hello everyone

I have project in android studio that has sign in functionality using firebase. When I run my app on emulator, I cannot use sign in, it says authentication failed. Does it mean that emulator has problems with internet connection or it means something else?

Root the emulator

Hello, is there any way to root the emulator please? Thank you 👍

Cannot install the emulator from the AVD Manager on M1

A few days ago, you updated the README saying that now its possible to install de M1 emulator directly from the AVD, including that it will not show ARM64 image versions anymore... but I can't find it. I'm using Android Studio 4.2 Preview (once the stable version sometimes freeze to me), but can't make the emulator work without downloading it from here.

Can you describe it better how to make it work? Which version of Android Studio are you using?

Thanks a lot!

Android studio arm64 emulator shows nothing but a black screen

It sounds like creating a AVD with arm64 image from Android Studio would work, but it's showing me nothing but a black screen. I tried different arm64 images (Nougat, S) as well as devices and got the same problem for them all. Also tried wiping data, changing emulated performance options.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.