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

[HowTo] Install Google Play Services on baseport 8 devices from Microsoft Windows (Not working)

asked 2019-05-08 12:20:09 +0300

this post is marked as community wiki

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

updated 2019-05-09 12:29:18 +0300

Giacomo Di Giacomo gravatar image

This wants to be a comprehensive guide for installing Android support on baseport 8 devices, currently the Xperia XA2 series. This procedure has not worked for me, so support is required by someone who got it working. The procedure currently available must be collected from a number of different posts on TJC, mostly vague and missing important details. I tried to sum up what I gathered from them in the following procedure, but could not get Android support to start. Corrections by someone who managed to get Play Services working are encouraged.

The steps are the following:

  1. Install on your pc a Windows binary version of lzip and squashfs-tools.
  2. Download a pico version of opengapps from opengapps.org for the ARM64.
  3. Get the /opt/alien/system.img file from the device. You can do so by copying it to the /home/nemo/Downloads directory and accessing the phone via USB in MTP mode.
  4. Choose or create a temporary folder on the PC (let's call it Temp). Unsquash thesystem.img file in a folder called system/ inside the temporary folder: unsquashfs.exe -d Temp/system yourpath/system.img.
  5. Extract the Core directory from the opengapps archive into a Core subdirectory of the Temp directory.
  6. Inside the Core subdirectory on the PC, decompress the following archives using lzip -d archivename: vending-arm, gsfcore-all, gmscore-arm64, gmssetup-all, googleonetimeinitializer-all, googlepartnersetup-all.
  7. Each of the decompressed archives is now in tar format. You can open them with winrar. Each of them contains one or more priv-app directories. If more than one is present, take the one under the nodpi path. Take the contents of the selected priv-app directory, one for each archive (in all cases it is another single directory), and copy them to the system/priv-app directory located inside the Temp/systemdirectory (Temp/system/system/priv-app).
  8. Repack the system into another system.img file: mksquashfs.exe system\ system.img -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments.
  9. Copy the new system.img file to the /home/nemo/Downloads directory on the phone via USB.
  10. Stop Alien Dalvik.
  11. Open a shell on the phone and enter root mode via devel-su.
  12. Rename the old file just in case: mv /opt/alien/system.img /opt/alien/system.img.old.
  13. Copy the new file: cp /home/nemo/Downloads/system.img /opt/alien/.
  14. Restart Alien Dalvik, or reboot the phone, and watch Android support not starting.

EDIT: The most likely cause for malfunction is Windows not preserving Unix file permissions. I can't think of an easy workaround for this. There would be the immediate solution of merging the files to the existing system.img, were it not that mksquashfs has been written in the moronic way that if it detects two identical directories, rather than adding the new files to the existing directory, it will create a new directory with a different name and put the new files in it. If somebody has a workaround for this idiotic behaviour of mksquashfs, suggestions are welcome.

edit retag flag offensive close delete

Comments

whatabout docker ? almost every middle class laptoo can run docker then yiu can run linux of your choice in it and do.the magic there ?

or with windows 10 (not all versions) you can run linux directly on windows i think its called subsystem or something like that. my 200 euro laptop was too waek for both :(

pawel ( 2019-05-10 17:25:35 +0300 )edit

@pawel I can also install VirtualBox and run a Linux virtual machine there. But the point is, I should keep and maintain a Linux installation just for this. Or I could connect my Raspberry Pi 3 and run the process there. But that's too much of a complication for me. I want to go to the PC I currently keep running and execute the procedure without having to dig out hardware or software at every SFOS update. Luckily, @Artur's procedure to run the process on the phone works fine. I will create a howto from that, just to have people find it clearly and not have to run through answers to unrelated questions.

Giacomo Di Giacomo ( 2019-05-10 17:55:32 +0300 )edit

4 Answers

Sort by » oldest newest most voted
6

answered 2019-05-08 19:39:45 +0300

Artur gravatar image

updated 2019-05-09 08:10:18 +0300

I have successfully installed opengapps from the phone, with no computer needed. Do this at your own risk, etc., but here is how I did it. If you modified the system.img before, uninstall then reinstall Android support to get the original system.img first.

  1. Install lzip and a version of squashfs-tools with lz4 support:

    pkcon install info
    rpm -i https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/l/lzip-1.16-1.fc22.armv7hl.rpm
    rpm -i https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/l/lz4-r128-2.fc22.armv7hl.rpm 
    rpm -i --nodeps https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/s/squashfs-tools-4.3-8.fc22.armv7hl.rpm
    
  2. Stop Android Support, run devel-su rm -rf /home/.android/*.

  3. Create an install_opengapps.sh script with the following content, and make it executable:

    #!/bin/sh
    
    set -e
    
    google_remove='carriersetup extservicesgoogle extsharedgoogle googlebackuptransport googlecontactssync googlefeedback googlepartnersetup'
    
    opengapps_zip="$1"
    
    if [ -f system.img.orig ]; then
        echo 'WARNING: reusing existing system.img.orig' >&2
    else
        cp /opt/alien/system.img system.img.orig
    fi
    
    unsquashfs system.img.orig
    
    unzip "$opengapps_zip" -d opengapps/
    
    for p in $google_remove; do
        rm "opengapps/Core/$p-all.tar.lz"
    done
    
    if [ -f opengapps/Core/extservicesgoogle-all.tar.lz ]; then
        rm -r squashfs-root/system/priv-app/ExtServices
    fi
    if [ -f opengapps/Core/extsharedgoogle-all.tar.lz ]; then
        rm -r squashfs-root/system/app/ExtShared
    fi
    
    rm opengapps/Core/setupwizardtablet-all.tar.lz
    
    mkdir opengapps_2
    for f in opengapps/Core/*.tar.lz; do
        lzip -c -d "$f" | tar -x -C opengapps_2
    done
    cp -r opengapps_2/*/*/* squashfs-root/system/
    
    rm -f system.img.gapps
    mksquashfs squashfs-root system.img.gapps -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments
    
    rm -r opengapps opengapps_2 squashfs-root
    
  4. Download opengapps, run install_opengapps.sh as root and pass the opengapps zip as a parameter (e.g. devel-su ./install_opengapps.sh ./Downloads/open_gapps-arm-8.1-pico-20190508.zip).

    (Running as root is necessary for unsquashfs to create files with the correct permissions when it unpacks the image.)

  5. Copy system.img.gapps to /opt/alien/system.img.

  6. Start Android support. If you are successful, in few minutes the Android setup screen should appear. Skip network configuration and finish the setup. In a few seconds you should get a notification about Google Play Protect. Click the notification and disable Play Protect. (If you miss it, open Google Play Store and check the three-dot-menu for the option; if the option is not there, close Play Store, wait a few minutes, and try again.)

  7. Install the Aptoide store from Jolla Store (if it is already installed, uninstall and install it again), then make sure you can open it. If the icon disappears, wait a few minutes.

    (This step is intended for testing if you can install Android applications, even if you want to uninstall Aptoide afterwards.)

edit flag offensive delete publish link more

Comments

2

Your procedure works fine for me, and it's also damn easy to carry out. I hope it will also be immediate to update. Will you write a how-to for this? It would be precious for people who don't have the time to fiddle around with the fone. If you won't, I can do it.

Giacomo Di Giacomo ( 2019-05-09 16:10:54 +0300 )edit

I'm glad to know it works. I would think this answer is a how-to already, but feel free to take information from it or the install script and write one however you want.

Artur ( 2019-05-10 00:38:47 +0300 )edit

I fail at phase 1. I try to copy this from the Sailfish Browser to Terminal. See only the first row "pkcon install info" in Terminal; it starts running, asks me to install some text documentation thingy, stops with

"Failed to obtain authentication."

teemu ( 2019-05-11 07:18:19 +0300 )edit

Do I use ARM or ARM64 version of gapps for Xperia XA2? Giacomo says ARM64, but Artur seems to be using the ARM version?

teemu ( 2019-05-11 07:29:39 +0300 )edit

Yeah ok I got through the phase 1. I was supposed to copypaste one row at a time to Terminal, right? laugh

I had authentication problems with installing the rpm's though, and had to do it as devel-su.

I ultimately got opengapps up and running (version open_gapps-arm-8.1-pico-20190511.zip)

Now apps like Easypark and HBO Nordic (that previously refused to go past the opening screen due to absent Google Play Services) at least let me try to sign up. In lack of subscription I can't check up atm if HBO Nordic will actually let me show content on a "rooted" device.

Downloading apps from Google Play doesn't seem to work. Any app says "downloading", but doesn't actually download. Is this excepted behavior (due to Play Protect or something)?

teemu ( 2019-05-11 12:36:18 +0300 )edit
1

answered 2019-05-08 16:44:53 +0300

Artur gravatar image

updated 2019-05-08 16:48:09 +0300

I successfully installed Google Apps from opengapps just yesterday, with opengapps pico 20190508. Unfortunately I do not have a Windows machine and thus cannot reproduce exactly what you did, but I extracted all .tar.lz files except for setupwizardtablet-all, and removed /system/app/ExtShared and /system/priv-app/ExtServices from the existing image (as the opengapps install script does to install extservicesgoogle and extsharedgoogle.

On step 7 you mention priv-app, but some of the archives would have app or etc instead (to be extracted to /system/app or /system/etc).

Also I stopped the aliendalvik service and removed /home/.android/data. This will delete all the Android apps and their data.

edit flag offensive delete publish link more

Comments

Can you detail which opengapps archive you used, in terms of architecture, date and completeness? I tried with the latest pico and nano, both arm and arm64.

Giacomo Di Giacomo ( 2019-05-08 16:49:13 +0300 )edit
1

open_gapps-arm64-8.1-pico-20190508

Artur ( 2019-05-08 16:50:54 +0300 )edit

That's the same one I used, so we can rule this one out.

Giacomo Di Giacomo ( 2019-05-08 17:09:35 +0300 )edit

Can you please report the exact command line for mksquashfs you used?

Giacomo Di Giacomo ( 2019-05-08 17:18:40 +0300 )edit
1

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

Artur ( 2019-05-08 17:29:57 +0300 )edit
0

answered 2019-05-10 13:34:59 +0300

Stanislav1988 gravatar image

updated 2019-05-12 16:40:58 +0300

Someone can help me, I have error when I try run this script

unzip: cannot find or open ./nemo/Downloads/open_gapps-arm-8.1-pico-20190510.zip,/Downloads/open_gapps-arm-8.1-pico-20190510.zip.zip or .Downloads/open_gapps-arm-8.1-pico-20190510.zip.ZIP.

UPDATE

Ok google play services work, I can use Google Chrome (log in into account work), Google Maps (working, I must test location ), Google Music (I can log in but still don`t see music library)

Ok some news about Google Music After when I try launch Google Music via Google Chrome it run Google Music app and from this moment I was able to see all my music in cloud and I can listen music music without any issues.

I discover that any changes in Googl Music on desktop synchronize when I use mobile data on phone, but on WiFi it don`t sync any changes.

edit flag offensive delete publish link more

Comments

Assuming you have the file open_gapps-arm-8.1-pico-20190510.zip in /home/nemo/Downloads, what is your home directory you are launching the script from? Anyway I preferred to cd to the directory and use ./open_gapps-arm-8.1-pico-20190508.zip as an argument to the script

Giacomo Di Giacomo ( 2019-05-10 13:47:06 +0300 )edit

@Giacomo Di Giacomo I copy only contet of script from this site, where I can set argument which file must search?

And I create sh file in /home/nemo/Downloads

Stanislav1988 ( 2019-05-10 14:06:37 +0300 )edit

When you launch the script from the shell, use the opengapps file as an argument as indicated above: devel-su ./install_opengapps.sh ./Downloads/open_gapps-arm-8.1-pico-20190508.zip, but make sure that the name and path of the file are correct.

Giacomo Di Giacomo ( 2019-05-10 14:22:03 +0300 )edit

./install_opengapps.sh: line 42: -no-exports: command not found what is this

Stanislav1988 ( 2019-05-10 15:44:07 +0300 )edit

It's that you inserted a new line character amidst the command line. mksquashfs squashfs-root system.img.gapps -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments must reside on a single line.

Giacomo Di Giacomo ( 2019-05-10 15:50:40 +0300 )edit
0

answered 2019-05-10 20:26:04 +0300

Stanislav1988 gravatar image

Link to script install.sh

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
10 followers

Stats

Asked: 2019-05-08 12:20:09 +0300

Seen: 1,109 times

Last updated: May 12 '19