# Building for Android x86

**URL:** <https://forum.castle-engine.io/t/building-for-android-x86/442>\
**Category:** News\
**Created:** [November 5, 2021, 6:05pm UTC](https://forum.castle-engine.io/t/building-for-android-x86/442 "2021-11-05T18:05:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [November 5, 2021, 6:05pm UTC](https://forum.castle-engine.io/t/building-for-android-x86/442/1 "2021-11-05T18:05:02Z")

</div>

| [![Application running in Android emulator (x86)](https://castle-engine.io/wp/wp-content/uploads/2021/11/Zrzut-ekranu-z-2021-11-04-01-13-36-200x153.png)](https://castle-engine.io/wp/wp-content/uploads/2021/11/Zrzut-ekranu-z-2021-11-04-01-13-36.png "Application running in Android emulator (x86)") |
| [![Application running in Android emulator (x86)](https://castle-engine.io/wp/wp-content/uploads/2021/11/Zrzut-ekranu-z-2021-11-04-00-40-07-200x153.png)](https://castle-engine.io/wp/wp-content/uploads/2021/11/Zrzut-ekranu-z-2021-11-04-00-40-07.png "Application running in Android emulator (x86)") |
| [![Application running in Android virtual machine (x86_64)](https://castle-engine.io/wp/wp-content/uploads/2021/11/cge-android-emu2-200x153.png)](https://castle-engine.io/wp/wp-content/uploads/2021/11/cge-android-emu2.png "Application running in Android virtual machine (x86\_64)") |
| [![Application running in Android virtual machine (x86_64)](https://castle-engine.io/wp/wp-content/uploads/2021/11/cge-android-emu3-200x153.png)](https://castle-engine.io/wp/wp-content/uploads/2021/11/cge-android-emu3.png "Application running in Android virtual machine (x86\_64)") |

The usual Android CPU, used by most of physical Android devices, is _Arm_ (32-bit or 64-bit). But sometimes it makes sense to build for Android _x86_ CPUs (32-bit _x86_, 64-bit _x86\_64_). The main use is to run such applications in emulators and virtual machines, like emulators provided in [Android SDK](https://developer.android.com/studio/) or a virtual machine installed using ISO from [Android-x86](https://www.android-x86.org/) project.

To do this, build Android APK using our [build tool](https://github.com/castle-engine/castle-engine/wiki/Build-Tool) like this:

```
castle-engine package --os=android --cpu=x86_64
```

You can add `--fast` and/or `--mode=debug` if you want.

Then just transfer the resulting APK inside the Android machine.

If you use an emulator installed by Android _AVD Manager_, and visible on the `adb devices` list, you can even install and run (showing logs from the device) using the standard `install` and `run` commands of our [build tool](https://github.com/castle-engine/castle-engine/wiki/Build-Tool), like this:

```
castle-engine --os=android --cpu=x86_64 install
castle-engine --os=android --cpu=x86_64 run
```

Note: Setting up the emulator using command-line _AVD Manager_ was unexpectedly hard, due to an enormous amount of questions I had to answer about the emulated machine. I recommend to use GUI to create new emulators instead, [run Android Studio](https://developer.android.com/studio/) and from _More Actions_ choose _AVD Manager_.

Note: The behavior of command `castle-engine package --target=android`, which you can use to create an APK for a “normal” Android device, has not changed. It still builds only for Arm (32-bit and 64-bit, aka Aarch64), assuming these are systems used on actual devices. Though we’re open to change this some day (if usage of Android x86 rises, and will be useful for more than just _“developers testing apps in virtual machines”_).

This has already somewhat worked in the past, but now we made it better:

1. Instructions to setup environment for this are adjusted on [Android docs](https://github.com/castle-engine/castle-engine/wiki/Android) and [Android FAQ](https://github.com/castle-engine/castle-engine/wiki/Android-FAQ). Following the stuff related to Android/x86 is completely optional, so if you have a working Android setup and are not interested in x86 support, just ignore it.

2. Our support libraries are now packaged with x86/x86\_64 variants too:
