[HowTo] MindTheGapps on Xperia XA2 (3.2.0.12 / 3.2.1.19)

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

this post is marked as community wiki

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

updated 2019-12-11 23:09:49 +0200

mjun gravatar image

###Updated for version 3.2.1.19!

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 3.2.0.12 and 3.2.1.19). 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 3.2.0.12 or 3.2.1.19 version of SFOS you don't have to do steps below manually - just download pre-patched system.img for 3.2.0.12 or 3.2.1.19

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

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

edit retag flag offensive close delete

Comments

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 +0200 )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 +0200 )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 +0200 )edit
1

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 +0200 )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 +0200 )edit