We have moved to a new Sailfish OS Forum. Please start new discussions there.

[HowTo] MindTheGapps on Xperia XA2 ( / /

asked 2019-11-22 22:41:51 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2020-04-24 17:19:25 +0300

mjun gravatar image

###Updated for version!

Inspired by this OpenGapps Wiki here is the simple guide how to get fully functioning Google Play Services on your Xperia X2 with minimum number of google components (tested on, and This method was developed and tested by @mjun.

Couple of notes:

  1. You will have to prepare the new system.img on your computer and not on the phone itself. The reason is rsync crashing sfos.
  2. You do not have to uninstall your currently installed android apps
  3. It's advisable to make backup of your current /opt/alien/system.img
  4. You will have to remove microG applications if you have them installed as they will conflict with Google apks
  5. If you are on, or version of SFOS you don't have to do steps below manually - just download pre-patched system.img for, or

Let's get started

  1. First things first - make backup of your current /opt/alien/system.img
  2. Copy /opt/alien/system.img to your computer as system.img.orig
  3. Get MindTheGapps zip from here
  4. unzip MindTheGapps zip:

    unzip MindTheGapps-8.1.0-arm64-20180808_153856.zip -d mindthegapps_sfos;
  5. Remove unnecessary google components and config:

    rm -rf mindthegapps_sfos/system/addon.d;
    rm -rf mindthegapps_sfos/system/app/GoogleExtShared;
    rm -rf mindthegapps_sfos/system/app/PrebuiltExchange3Google;
    rm -rf mindthegapps_sfos/system/etc/permissions/com.google.android.dialer.support.xml;
    rm -rf mindthegapps_sfos/system/etc/sysconfig/google_build.xml;
    rm -rf mindthegapps_sfos/system/framework/com.google.android.dialer.support.jar;
    rm -rf mindthegapps_sfos/system/priv-app/AndroidMigratePrebuilt;
    rm -rf mindthegapps_sfos/system/priv-app/GoogleExtServices;
    rm -rf mindthegapps_sfos/system/priv-app/GoogleFeedback;
    rm -rf mindthegapps_sfos/system/priv-app/GoogleOneTimeInitializer;
    rm -rf mindthegapps_sfos/system/priv-app/GooglePartnerSetup;
    rm -rf mindthegapps_sfos/system/priv-app/SetupWizard;
    rm -rf mindthegapps_sfos/system/priv-app/Velvet;
  6. Unsquash system.img.orig with rsync (we use rsync to avoid file permissions problems)

    mkdir -p tmp-mount squashfs-root;
    sudo mount -o loop,ro system.img.orig ./tmp-mount;
    sudo rsync -avPSHAX --inplace tmp-mount/ squashfs-root;
    sudo umount ./tmp-mount;
    sudo rmdir tmp-mount;
  7. Copy google apps to unsquashed system.img.org:

    sudo cp -r mindthegapps_sfos/system/* squashfs-root/system/
  8. Create new system.img:

    sudo mksquashfs squashfs-root system.img.gapps -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments

Almost done! Now let's update the image on the phone itself!

  1. Stop android support on your phone
  2. Copy system.img.gapps to your XA2 as /opt/alien/system.img (thus overwriting the original image)
  3. Start android support

If this is your first time setting up patched system.img you can additionally: 4. Go to aliendalvik settings Users & accounts and add google account (or open play store and sign in) 5. Open play store and disable Play protect and auto-updates

Known problems

  1. Play store might briefly work but will eventually update itself and your app installs will get stuck in 'pending' state - just use Aurora Store
  2. GPS assisted positioning might be a bit of a hit and miss. Go to aliendalvik settings and under Security & location set Location to ON / High accuracy. Additionally Install F-Droid and add microG repository. Install All of the NLP packages in (GAPPS) variant. Configure UnifiedNlp providers. You might also want to install XposedUnifiedNlp

Tested google apps that work OK

  1. YouTube - everything including the floating mini player
  2. Gmail
  3. Google Photos - with photo backup and sync
  4. Chrome

Other non-google apps tested (latest versions)

  1. Uber (latest version)
  2. HERE WeGo maps
  3. Facebook Messenger Lite
  4. Revolut
  5. Slack
  6. WhatsApp
  7. Telegram
  8. Firefox (stable)

Feel free to improve this guide and/or ask any questions!

edit retag flag offensive close delete


will a google calendar work (either on Google itself or via DavX5)? are there any notable differences to the microG implenetation?

danfin ( 2019-11-23 15:05:06 +0300 )edit

If we are talking about this app then yes - it works just fine. I haven't tested it thoroughly though, as I didn't like google's concept of calendar app.

mjun ( 2019-11-23 22:14:07 +0300 )edit

Copied system.img.gapps to /opt/alien/system.img. Play store is stuck at Checking info. Clicking on "Add account" does nothing. Not sure if this works.

ashakunt ( 2019-11-24 02:38:17 +0300 )edit

This is what I did and seemed to work:

  1. Copy the system.img.gapps to /opt/alien/system.img
    1. Installed Fdroid
    2. Installed Aurura Store
    3. Login to Aurora Store and update google services
    4. Installed Instagram; it worked.
ashakunt ( 2019-11-24 03:49:55 +0300 )edit

@ashakunt If you had microG apps installed prior to replacing system.img try uninstalling microG apps and restart your phone, then try again. You can also go to aliendalvik settings -> Apps & notifications, then open "google play services" and "google play store" and for both apps go to "Storage" option and then "clear cache" and "Manage space"/"clear data". Restart android support and try again. It should work.

When google account sign-in gets stuck on "Checking info" it usually means either broken permission when unpacking original system.img or previously installed apps that interact with google in some way.

As a last resort, if you don't mind losing all of your currently installed android apps you can try this:

  1. stop android support
  2. ssh to your phone and remove everything under /home/.android directory and /home/nemo/android_storage:

    rm -rf /home/.android/*
    rm -rf /home/nemo/android_storage/*

  3. start android support and try to add google accont in settings (or sign in with play store)

mjun ( 2019-11-24 18:34:25 +0300 )edit

3 Answers

Sort by » oldest newest most voted

answered 2020-03-08 19:52:22 +0300

campeon gravatar image

updated 2020-03-08 19:52:55 +0300

Good afternoon.... I have a question.... if anyone can help... Regarding Note 5....

If you are on or version of SFOS you don't have to do steps below manually - just download pre-patched system.img for or

Does anyone know if it applies too to ??

Thanks for your help.

edit flag offensive delete publish link more


Pre-patched system.img is working for me on SFOSX (Xperia 10 Plus)

dr.moises ( 2020-04-01 17:55:46 +0300 )edit

@campeon Yes, it works with I have also updated the wiki and provided new pre-patched image for

mjun ( 2020-04-02 23:11:09 +0300 )edit

answered 2020-04-06 00:35:25 +0300

shults gravatar image

updated 2020-04-08 20:28:23 +0300

Locatio. doesn't work. Almost every android app doesn'tfind location. I tryed to install all nlp packs from fdroid microg repo but the self check shows: systr. supports location.provider -unchecked. UnifiedNLP is registerred - unchecked. Restart doesn't change anything. image description

How to recognize which backend to use?

edit flag offensive delete publish link more



First GPS fix may take a long time, even 10 minutes (!). After that it should find your location faster. To make sure it's not related to android, try first location fix with some native SFOS navigation app.

Regarding microG NLP packages - double check that that you have only GAPPS variants installed (no-GAPPS variants might interfere with google locations services). Also, make sure that you configure all of the NLP providers.

mjun ( 2020-04-06 20:38:52 +0300 )edit

I have good working GPS in.all native apps. In.android some apps (not googke dependent are working a.bit slowly but good. Whe.I turn on the fast localisation.option everything.in.android breaks. Some.of the NLP packs don't.have.description.whether.they are gapps or.no-gapps in F-droid. Is there a kist or how can.I check. Should I enable the ”search for wifi” or search for bluetooth options?

shults ( 2020-04-07 09:44:50 +0300 )edit

At minimum you need these two packages:

I also have these installed:

Under UnifiedNlpSettings I have only three check-marks:

  • Permission to access approximate location (network-based)
  • Location backend(s) setup
  • Network-based location enabled

I have configured location backends (downloaded cell towers and went through all settings that are available).

mjun ( 2020-04-08 23:35:23 +0300 )edit

I followed the procedure twice, secind time with completely reinstalled android support. At the end location with google.play services doesn't work normally. Some apps never find location :Whatsapp, Flightradar, fuelo, accuweather, the weather channel. The.only way that Google maps shows the blue dot is if I start the Here maps app installed from Jolla store. If I.update Here maps it also stops. MapsMe, Waze are working perfectly. If my Sony Xperia XA2 plus dual sim is not supported by the provided prepatched sistem images is it OK to install microG over them? Can I make some test or analyze before going to.microG? Can someone confirm that the.apps are working properly?

shults ( 2020-04-22 22:58:45 +0300 )edit

answered 2020-07-21 13:58:13 +0300

deutch1976 gravatar image

Hello all. When trying to copy file to Phone it gives error 3 code permission denied Any ideias? Thanks

edit flag offensive delete publish link more


switch to root using devel-su and try again

santhoshmanikandan ( 2020-07-21 17:57:31 +0300 )edit

Already did that

deutch1976 ( 2020-07-21 22:22:34 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2019-11-22 22:41:51 +0300

Seen: 4,006 times

Last updated: Jul 21