fieryhenry / tbcml

A python library designed to make modding The Battle Cats easier, more automated, and more powerful
GNU General Public License v3.0
13 stars 3 forks source link

Failed to pack APK #4

Closed MrNooberDude closed 1 year ago

MrNooberDude commented 1 year ago

Here's the log.

Failed to pack APK: I: Using Apktool 2.7.0
brut.directory.DirectoryException: java.nio.file.NoSuchFileException: C:\Users\gatli\AppData\Roaming\tbcml\APKs\12.5.0en\extracted

Failed to sign APK: Enter Passphrase for keystore: jarsigner: unable to open jar file: C:\Users\gatli\AppData\Roaming\tbcml\APKs\12.5.0en\jp.co.ponos.battlecatsen-modded.apk

Is there something I either did wrong or is this a bug?

fieryhenry commented 1 year ago

is there any more output than that?

MrNooberDude commented 1 year ago

Nope. Don't know why it happened other than maybe a different version of JDK screwing up.

fieryhenry commented 1 year ago

what apk version are you using?

MrNooberDude commented 1 year ago

12.5.0 (I downloaded it from APK Pure, might that be the issue?)

fieryhenry commented 1 year ago

Can you try an older version, e.g 12.3 and see if you still get the error

MrNooberDude commented 1 year ago

Still got the error. maybe it's an error with the directory based on how it's looking for the extracted folder when the only other folder is original_extracted.

fieryhenry commented 1 year ago

can you send the script that you are using?

MrNooberDude commented 1 year ago

Here it is!

from tbcml.core import (
   CountryCode,
   GameVersion,
   Apk,
   GamePacks,
   Mod,
   ModEdit,
   CatFormType,
   Cat,
   CatForm,
)

# Choose the country code
cc = CountryCode.EN

# Choose a game version
gv = GameVersion.from_string("12.6.0")

# Get the apk
apk = Apk(gv, cc)
apk.download_apk()
apk.extract()

# Download server files data
apk.download_server_files()
apk.copy_server_files()

# Get the game data
game_packs = GamePacks.from_apk(apk)

# Create a mod id, or use an existing one
mod_id = Mod.create_mod_id()

# Create a mod, not all information is required
mod = Mod(
   name="Test Mod",
   author="Test Author",
   description="Test Description",
   mod_id=mod_id,
   mod_version="1.0.0",
   password="test",
)

# Define cat information
cat_id = 0
cat_form_type = CatFormType.FIRST

# Create a form
form = CatForm.create_empty(cat_id, cat_form_type)

# Set the form's name to "Test Cat"
form.name = "Test Cat"

# Create a cat
cat = Cat.create_empty(cat_id)

# Set the form
cat.set_form(cat_form_type, form)

# Create a mod edit
mod_edit = ModEdit(["cats", cat_id], cat.to_dict())

# Add the mod edit to the mod
mod.add_mod_edit(mod_edit)

# Add the mod to the game packs
apk.load_mods([mod], game_packs)

# open the apk folder in the file explorer (optional)
apk_folder.open()
fieryhenry commented 1 year ago

Still got the error. maybe it's an error with the directory based on how it's looking for the extracted folder when the only other folder is original_extracted.

Is there an apk in that folder?

MrNooberDude commented 1 year ago

the apk is there along with the original_extracted folder, but thats it. could you maybe give me the apk that works for you?

fieryhenry commented 1 year ago

what file size is the apk?

MrNooberDude commented 1 year ago

151,593kb

fieryhenry commented 1 year ago

is there anything in the original_extracted folder?

MrNooberDude commented 1 year ago

Yeah, its just the apk opened up like a zip. Guessing that's intentional.

MrNooberDude commented 1 year ago

Ok, so I tried updating to the newest version and got this:

[######################################################################] 100% (159.89 MB/159.89 MB)    Failed to extract APK: Input file (C:\Users\gatli\AppData\Roaming\tbcml\APKs\12.6.0en\jp.co.ponos.battlecatsen-original.apk) was not found or was not readable.

Traceback (most recent call last):
  File "C:\Users\gatli\Desktop\BCU\Battle Cats\TBCModLoader-1.0.0\script.py", line 25, in <module>
    apk.download_server_files()
  File "C:\Users\gatli\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tbcml\core\io\apk.py", line 636, in download_server_files
    sfh = core.ServerFileHandler(self)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gatli\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tbcml\core\server_handler.py", line 27, in __init__
    self.game_versions = self.find_game_versions()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\gatli\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\tbcml\core\server_handler.py", line 199, in find_game_versions
    raise ValueError("Could not find libnative.so")
ValueError: Could not find libnative.so
fieryhenry commented 1 year ago

doesC:\Users\gatli\AppData\Roaming\tbcml\APKs\12.6.0en\jp.co.ponos.battlecatsen-original.apk exist?

MrNooberDude commented 1 year ago

didn't before because I didn't realize that it didn't put the file there. After I got an version 12.6.1 apk, I put it there, and once again it failed to extract because the extracted folder didn't exist.

MrNooberDude commented 1 year ago

tried creating my own extracted folder but it deleted it for some reason

fieryhenry commented 1 year ago

i'll boot up my windows vm and see if i can replicate the issues

MrNooberDude commented 1 year ago

alright then 👍

MrNooberDude commented 1 year ago

So... It's been a bit. Have you made any progress?

fieryhenry commented 1 year ago

No, not really. I couldn't replicate the issue on windows unfortunately. I'm not really sure how to fix it

MrNooberDude commented 1 year ago

Alright then. I'll try doing it through a VM. Thanks for the help though!