This works to install Open GApps into the Android Emulator, working around the issue where the system partition is too small.
With it, I can get Google Play installing into the emulator. Tested on KitKat (API 19), Lollipop (API 21) and Oreo (API 27).
It's tested on MacOS.
- Ensure you have
unzip
,lzip
,tar
,emulator
andadb
in yourPATH
. - From Android Studio (v3.0.1) create a new Android Virtual Device (AVD). For example:
- Tools -> Android -> AVD Manager
- Create Virtual Device...
- Phone -> Nexus 5
- x86 Images -> Lollipop -> Marshmallow (API 23 x86_64) (Download if necessary)
- Give the AVD a name ("Nexus 5 Marshmallow API 23 x86_64")
- Choose "Show Advanced Settings...". Give the AVD at least 1536MB Internal Storage, and 512MB SD Card
- Finish
- Download the appropriate Open GApps file from opengapps.org (x86_64 / 6.0 / micro)
- Save the
open_gapps_install_script.sh
into the same folder, and give it executable permission:chmod 755 open_gapps_install_script.sh
- Run the
open_gapps_install_script.sh
with the Open GApps file as the first argument; e.g.open_gapps_install_script.sh open_gapps-x86_64-6.0-micro-20180123.zip
- When prompted for an AVD, copy the appropriate AVD name and paste it. Press Enter.
- Wait for the emulator to boot fully, then press Enter.
- Once the script tells you to "Restart android in your emulator", hold down the virtual power button to shutdown.
- Manually start the emulator again (press the 'play' button in Android Studio's AVD Manager).
- In the emulator, open the Google app and sign in with your google account.
- Shut down the emulator and start it again.
A sample transcript follows.
$ ./open_gapps_install_script.sh open_gapps-x86_64-6.0-micro-20180123.zip
Archive: open_gapps-x86_64-6.0-micro-20180123.zip
signed by SignApk
extracting: /tmp/gapps_installer/Core/configupdater-all.tar.lz
extracting: /tmp/gapps_installer/Core/defaultetc-common.tar.lz
extracting: /tmp/gapps_installer/Core/defaultframework-common.tar.lz
extracting: /tmp/gapps_installer/Core/gmscore-x86_64.tar.lz
extracting: /tmp/gapps_installer/Core/googlebackuptransport-all.tar.lz
extracting: /tmp/gapps_installer/Core/googlecontactssync-all.tar
extracting: /tmp/gapps_installer/Core/googlefeedback-all.tar.lz
extracting: /tmp/gapps_installer/Core/googleonetimeinitializer-all.tar.lz
extracting: /tmp/gapps_installer/Core/googlepartnersetup-all.tar.lz
extracting: /tmp/gapps_installer/Core/gsfcore-all.tar.lz
extracting: /tmp/gapps_installer/Core/gsflogin-all.tar.lz
extracting: /tmp/gapps_installer/Core/setupwizarddefault-all.tar.lz
extracting: /tmp/gapps_installer/Core/setupwizardtablet-all.tar.lz
extracting: /tmp/gapps_installer/Core/vending-x86_64.tar.lz
Which AVD?
Nexus_5X_Oreo_8.1_API_27
Nexus_5_KitKat_API_19_32-bit_x86
Nexus_5_Lollipop_API_22_32-bit
Nexus_5_Marshmallow_API_23_x86_64
>Nexus_5_Marshmallow_API_23_x86_64
determining location of system.img file for Nexus_5_Marshmallow_API_23_x86_64 .../Users/mikecunneen/Library/Android/sdk/system-images/android-23/google_apis/x86_64/
copying, checking and resizing system.img for Nexus_5_Marshmallow_API_23_x86_64
copying encryptionkey.img ...
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
system: 1958/98304 files (0.0% non-contiguous), 358163/393216 blocks
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /Users/mikecunneen/.android/avd/Nexus_5_Marshmallow_API_23_x86_64.avd/system.img to 524288 (4k) blocks.
The filesystem on /Users/mikecunneen/.android/avd/Nexus_5_Marshmallow_API_23_x86_64.avd/system.img is now 524288 (4k) blocks long.
starting Nexus_5_Marshmallow_API_23_x86_64
Press enter when the emulator has booted...
adbd is already running as root
remount succeeded
etc/: 11 files pushed. 3.8 MB/s (58819 bytes in 0.015s)
framework/: 3 files pushed. 34.8 MB/s (212217 bytes in 0.006s)
app/: 1 file pushed. 81.9 MB/s (284795 bytes in 0.003s)
priv-app/: 9 files pushed. 188.1 MB/s (93280033 bytes in 0.473s)
restart android in your emulator
done.
@cunneen @tenzap
Anyone, need your help here:
The script above is obsolete, I'm try to fix it but still having some error:
My setup:
The error says:
Here is my updated script