Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Bugs in APKX #6

Closed
henfri opened this issue Nov 21, 2021 · 13 comments
Closed

Bugs in APKX #6

henfri opened this issue Nov 21, 2021 · 13 comments
Labels
new-feature New feature for WSAtools

Comments

@henfri
Copy link

henfri commented Nov 21, 2021

Hello,

when installing apkx, 7z may ask if it shall overwrite files. This goes to >NUL.

7z e -aoa adb.zip -otemp >nul
and
7z e -aoa "%apk%" -otemp

Furthermore fart is not in temp, but in the parent directory:

..\fart "temp.bat" "com." "adb install "com." >nul
..\fart "temp.bat" "config" "adb install config" >nul
..\fart -C "temp.bat" temp.bat "  " >nul

Then, after these fixes, I still get:

Files: 21
Size:       2935443
Compressed: 2938182
The System could not find the file.
Replaced 0 occurence(s) in 0 file(s).
Extracting ADB to temp directory...
Installing...
Performing Streamed Install
adb: failed to install config.ar.apk: Failure [INSTALL_FAILED_INVALID_APK: Full install must include a base package]
Performing Streamed Install
adb: failed to install config.de.apk: Failure [INSTALL_FAILED_INVALID_APK: Full install must include a base package]
Performing Streamed Install
adb: failed to install config.en.apk: Failure [INSTALL_FAILED_INVALID_APK: Full install must include a base package]
Performing Streamed Install
adb: failed to install config.es.apk: Failure [INSTALL_FAILED_INVALID_APK: Full install must include a base package]
Performing Streamed Install

Any Idea?

Best regards,
Hendrik

@henfri henfri added the new-feature New feature for WSAtools label Nov 21, 2021
@henfri
Copy link
Author

henfri commented Nov 21, 2021

The temp.bat:


adb install config.ar.apk
adb install config.de.apk
adb install config.en.apk
adb install config.es.apk
adb install config.fr.apk
adb install config.hi.apk
adb install config.in.apk
adb install config.it.apk
adb install config.ja.apk
adb install config.ko.apk
adb install config.my.apk
adb install config.pt.apk
adb install config.ru.apk
adb install config.th.apk
adb install config.tr.apk
adb install config.vi.apk
adb install config.xxxhdpi.apk
adb install config.zh.apk
de.wgr.bibox2.apk

and the content of the folder:

config.ar.apk
config.de.apk
config.en.apk
config.es.apk
config.fr.apk
config.hi.apk
config.in.apk
config.it.apk
config.ja.apk
config.ko.apk
config.my.apk
config.pt.apk
config.ru.apk
config.th.apk
config.tr.apk
config.vi.apk
config.xxxhdpi.apk
config.zh.apk
de.wgr.bibox2.apk

@henfri
Copy link
Author

henfri commented Nov 21, 2021

Just noticed now, that a windows error message (i.e. NOT on the commandprompt window) came up:
....\main\temp\AdbWinApi.dll:
No App is associated to this action. Install the app or assign a standard app.

@weareblahs
Copy link
Owner

Just noticed now, that a windows error message (i.e. NOT on the commandprompt window) came up: ....\main\temp\AdbWinApi.dll: No App is associated to this action. Install the app or assign a standard app.

Saying about this: Actually maybe there's a line generated when listing folder contents to the temp.bat file, which includes unnecessary ADB files (AdbWinApi.dll / adb.exe).

Also, thanks for letting me know that ..\adb goes to ADB at the parent folder. I don't have to include the ZIP file at the next release.

@henfri
Copy link
Author

henfri commented Nov 25, 2021

Saying about this: Actually maybe there's a line generated when listing folder contents to the temp.bat file, which includes unnecessary ADB files (AdbWinApi.dll / adb.exe).

I had posted the temp.bat file. I do not see anything unneccessary.
What I suspect is, that you have installed ADB properly, whereas if I use the downloaded adb from your github, "something" is different ("fileassociation").

I think it would be useful if you tested this on a "blank" virtual machine once.

Also, thanks for letting me know that ..\adb goes to ADB at the parent folder. I don't have to include the ZIP file at the next release.

I was refering to fart.exe, not adb.exe
Also here, I think on your computer it finds your installed adb.exe or fart.exe (it is on the system PATH). But on my machine, that is not the case.

Best regards,
Hendrik

@weareblahs
Copy link
Owner

weareblahs commented Nov 25, 2021

I think to make the installation process as I expected, I'll move the ADB files to another C:\adb directory then make it as one of the properties of PATH. This also applies to fart where it will be stored at C:\fart.

Or, should I put these files in System32?

I think it would be useful if you tested this on a "blank" virtual machine once.

Thanks for the suggestion. This will let me to experience how do the installation process go for a new user. Will be doing it soon.

@henfri
Copy link
Author

henfri commented Nov 25, 2021

Hello,
I do not think that creating several folders (c:\fart c:\adb) would make sense. I would rather suggest to require an installation in c:\wsatools\ and add that and c:\wsatools\adb and c:\wsatools\fart to the PATH in the batch script.

Put in fact, I think that is not neccessary. I think that you will get the same error as I did and you can fix those with the suggestions I made in my first post.

I would NOT mess with putting files to System32.

@weareblahs
Copy link
Owner

weareblahs commented Nov 27, 2021

I think I know what happened - which applies at both InstallAPK and InstallXAPK - I forgot to add cd main before most of the commands so it won't get ADB to run on PCs which didn't have ADB on PATH.

Will have a fix soon.

@weareblahs
Copy link
Owner

Also, about this:

  • Weird where the script didn't generate adb install before de.wgr.bibox2.apk, which is at the last line. Will also check at this issue later.

@weareblahs
Copy link
Owner

weareblahs commented Nov 27, 2021

Try this one before I make it released. You can check if it's running without ADB and 7-zip at PATH - most of the adb and 7z properties are replaced with ..\main\adb and ..\main\7z.

@echo off

echo Windows Subsystem for Android XAPK app installer
echo This script uses adb and simplifies installation for XAPK bundles on WSA.
echo Before you start, please ensure that you toggled "Developer Mode" on in WSA settings.
echo Please note that OBB files are not supported by this script at the moment. After installation, the script will exit by itself.
echo Done? then press any key to continue the process.

:: Pre-installation - restarting WSA
WsaClient.exe /restart

:: The following line hides "Press any key to continue" and didn't show text for the process.
pause >nul

:: The line below goes to the APK Installation process listed below
GOTO apk_install

:apk_install
set /P apk=Drag and drop your XAPK bundle here / type in the path here then press "Enter":

:: Extract XAPK to temp dir and create batch file
cd ..
echo Extracting APK file...
mkdir temp
..\main\7z e -aoa "%apk%" -otemp

:: Delete icon and manifest, then create batch
cd temp
del icon.png
del manifest.json
cd temp
dir /b > temp.bat

:: Create batch (2) - Replace stuffs
fart "temp.bat" "com." "..\main\adb install "com."
fart "temp.bat" "config" "..\main\adb install config"
fart -C "temp.bat" temp.bat "  "

:: Run final generated ADB script
cd temp
..\main\adb connect localhost:58526 >nul
echo Installing...
temp.bat

echo Installation complete!
pause
exit

:::: (Reserved for future uses)
:: Complete prompt
:: echo Installation complete!
:: set /p var=Do you want to install other XAPK files? [Yes / (No)]: 
:: if %var%== Yes GOTO apk_install
:: if %var%== yes GOTO apk_install
:: if not %var%== No exit
:::: (Don't know why this part can't run, if you know why then submit a pull request with the modified script)

Also, need to ask something, how can I run the rest of the script after I run a batch file? Something like: Run script > Run batch file inside script THEN do not exit, run the rest of the script.

@henfri
Copy link
Author

henfri commented Nov 27, 2021

Hello,

it does not work yet :-(

cd temp
dir /b > temp.bat

:: Create batch (2) - Replace stuffs
fart "temp.bat" "com." "..\main\adb install "com."
fart "temp.bat" "config" "..\main\adb install config"
fart -C "temp.bat" temp.bat "  "

:: Run final generated ADB script
cd temp

you change to temp then you do something (here you miss the path to fart) and then you change to temp again.
I think that the relative paths are a bit messy. You could use this to get the path of the script:
https://stackoverflow.com/questions/3827567/how-to-get-the-path-of-the-batch-script-in-windows

So: %~dp0 is the path of this batch script (so main)
Fart would be at %~dp0\fart.exe

That should work.

Have you really tried this on a fresh install?

Regarding your last question

For your last question:

Use CALL as in

CALL nameOfOtherFile.bat
This will block (pause) the execution of the current batch file, and it will wait until the CALLed one completes.

If you don't want it to block, use START instead.

And then, remove the exit in the script that you called.

Best regards,
Hendrik

@weareblahs
Copy link
Owner

weareblahs commented Dec 7, 2021

Have you really tried this on a fresh install?

Sorry for (super) late reply, but currently working on WSAtools now. Kinda busy recently. The "Fresh install" that you mean - well, I assumed that it's the same with deleting 7z.exe and adb.exe from the directory that I set at PATH.

'%~dp0' is not recognized as an internal or external command,
operable program or batch file.

Weird where %~dp0 doesn't work on my own PC running Windows 11 22000.348. So, will use %cd% for pointing out the EXE files that I used for the repo. (%cd% has the same thing as %~dp0.)

Already noticed about the FART error in the InstallXAPK script.

@weareblahs
Copy link
Owner

weareblahs commented Dec 7, 2021

You can test it by downloading this, unzipping it then copy to the "main" dir:
InstallXAPK.zip [Updated 8 Dec 2021 10:39 MYT]

Here's some more visible changes:
XAPK now installs through the install-multiple command on ADB. Example for Reddit:

G:\git-working\wsatools\releases\main\temp\..\adb install-multiple com.reddit.frontpage.apk config.arm64_v8a.apk config.de.apk config.en.apk config.es.apk config.fr.apk config.it.apk config.pt.apk config.xxhdpi.apk

Note that G:\git-working\wsatools\releases\main\temp\..\adb is %cd%\..\adb at the batch file itself.

Also, need to ask: the CALL (batchfile) needs to be in temp.bat or the original InstallXAPK.bat?
Example: after running the temp.bat script, it will run cd .. && PostInstallXAPK.bat (PostInstallXAPK.bat file linked

@weareblahs
Copy link
Owner

weareblahs commented Dec 9, 2021

Update: this update is tried on a device without ADB and FART being on PATH and it worked - Now on WSAUtilities v0.0.9.

You can make a new issue if you have any problems regarding this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-feature New feature for WSAtools
Projects
None yet
Development

No branches or pull requests

2 participants