alesimula / wsa_pacman

A GUI package manager and package installer for Windows Subsystem for Android (WSA)
GNU General Public License v3.0
3.9k stars 836 forks source link

Add support for xapk #32

Closed basharast closed 2 years ago

basharast commented 2 years ago

Hi, I really thank you for this app and for your continues development, I hope if it's possible to add .xapk support in the future so it will be easier than using XAPK installer from Google Store

I found something related to xapk installation via adb HERE

Many thanks.

alesimula commented 2 years ago

@basharast In order to do that I'd need to know the specifications of the xapk format; I know it's basically just an archive with one or multiple apk files, but they're not necessarily all needed (I read it might also have two different apks for different architectures).

In order to implement this I'd need multiple examples of xapk files, and possibly detailed specs of the manifest file, including how i can differentiate between an apk that should always be installed and one I should install conditionally (eg. for arm64 devices)

akuropka commented 2 years ago

From what I know xapk is basically apk and obb combined and used by unofficial stores to distribute obb files. I guess on APKpure you can find such apps. More interesting would be apkm which are bundled files for different languages/systems. Chrome is for example distributed as apk and apkm which may help to understand differences. The official APKMirror installer can handle such files. The related article on Android Police gives some insight on app bundles.

alesimula commented 2 years ago

@akuropka @basharast I also found here an xapk file may also contain split apk files. I'd need at least an example (but I'd prefer many) of xapk files

akuropka commented 2 years ago

PUBG Mobile Among Us Google Duo Web.de Mail

alesimula commented 2 years ago

@akuropka Hmm, I'm still trying to understand what apks I should install; some are obvious (eg. config.it.apk config.en.apk.... config.arm64.apk); some are way less obvious: for example, the Chrome browser has some files like vr.apk, weblayer.apk, extra_icu.apk, chrome.apk (which is not the base apk) etc...

The manifest does not seem to have any extra info about those files, am I just supposoed to install all of them except language and architecture-specific configuration? (I guess so?)

ShlomoCode commented 2 years ago

@alesimula Might help: https://apkpure.com/xapk.html

akuropka commented 2 years ago

The basic procedure for installing xapk is:

  1. unzip xapk
  2. adb push obb file(s), if any, to the device
  3. adb install-multiple all apks fitting the architecture including all languages while the base should be listed first
alesimula commented 2 years ago

@akuropka so just install everything? Ok

akuropka commented 2 years ago

Yes, as long as architecture fits. 💪 You’re usually installing all language files as user may change locale from Android settings.

alesimula commented 2 years ago

@akuropka only issue is all xapk I found so far only have a arm64 architecture file

basharast commented 2 years ago

I guess the arm64 is config file, the main package will be under the com.example.app.etc without architect, you may need to skip that arm64 config but it will subject to the test the config.arm64 should be included after the test

basically it's possible for x86,x64 emulator to emulate the android apps as they are. usually I can test the same app in both mobile and PC no architect specified.

Update: I just did a test using the command (Among Us): adb install-multiple com.innersloth.spacemafia.apk config.arm64_v8a.apk

and successfully installed the app.

alesimula commented 2 years ago

@basharast yeah, without any architecture configuration the app would just crash, with arm64_v8a it will at least play the intro and home screen music, that's... sus

akuropka commented 2 years ago

There are different architectures available, some are not supported by Android itself anymore but still may be supplied by the user for installation. Some I just have in mind are armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64. If there's an x86_64 then only this one should be applied. The config_arch apks include platform sepcific libraries. However, all is depending against which platforms the app was built.

Regarding Among Us I think there are generally no x86 builds available. While WSA emulates arm it may run or may not which is not an issue of @alesimula's great work. With the 2021.12.15 version I get a network error while 2021.6.30 seems to run (I'm not a gamer so I did not elaborate further).

I got the Web.De Mail app up and running with the arm64_v8a config. Chrome for example does not run due to missing GMS. I think the provided way of installing xapks works in General.

Side note: Rafael has a great compatibility list available: Link. WSA ist still highly experimental and not officially available.

MmyGgithubAaccount commented 2 years ago

Instead of installing every language split apk, it might be better to let the user choose which ones they might want to install like how SAI does

alesimula commented 2 years ago

@basharast @akuropka @MmyGgithubAaccount @ShlomoCode I added xapk support (with obb support). For now it installs all language options and only one architecture option (best matching one, it prefers amd64 archs)

Temporary files should be deleted even if the application is forcefully closed (unless killed when installation is in progress)

ShlomoCode commented 2 years ago

Temporary files should be deleted

Where from?

alesimula commented 2 years ago

@ShlomoCode they're temporally extracted inside a folder in %temp% (Which would be "C:\Users\YOUR_USERNAME\AppData\Local\Temp"); as I said, they will be immediately cleaned up so you don't have to worry about them

The subfolder will be called "WSA-PacMan-${RANDOM}/XAPK-Extracted@${PROCESS_ID}@${RANDOM}"