Skip to content

addpkg(main/apktool): 3.0.1#28991

Open
xingguangcuican6666 wants to merge 1 commit into
termux:masterfrom
xingguangcuican6666:apktool
Open

addpkg(main/apktool): 3.0.1#28991
xingguangcuican6666 wants to merge 1 commit into
termux:masterfrom
xingguangcuican6666:apktool

Conversation

@xingguangcuican6666
Copy link
Copy Markdown
Contributor

Apktool is a tool for reverse engineering Android apps (decoding, rebuilding, and smali debugging).

Copy link
Copy Markdown
Member

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use rm -rf disabled-packages/apktool, then git add . , then git commit --amend, then git push -f origin apktool

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

Why was the original apktool disabled?

@robertkirkman
Copy link
Copy Markdown
Member

The commit message said it's because it's "not working"

@robertkirkman
Copy link
Copy Markdown
Member

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

xingguangcuican6666 commented Mar 18, 2026

Okay, I understand. I'll give it a try and see

@xingguangcuican6666 xingguangcuican6666 force-pushed the apktool branch 15 times, most recently from 958e77b to ba63b9f Compare March 18, 2026 03:59
@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

xingguangcuican6666 commented Mar 18, 2026

@robertkirkman I think I fixed it.
image

@xingguangcuican6666 xingguangcuican6666 marked this pull request as ready for review March 18, 2026 04:59
Copy link
Copy Markdown
Member

@robertkirkman robertkirkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, for me, the original problem is still reproducible.

To reproduce the error, a precompiled Android APK (any) is required as test data

These commands produce it:

apktool d app.apk -o test
apktool b -o out.apk test

here is the error:

I: Using Apktool 3.0.1-dirty on soh.apk with 6 threads
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes4 folder into classes4.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Building resources with aapt2...
Exception in thread "main" brut.androlib.exceptions.AndrolibException: brut.common.BrutException: Execution failed (exit code = 2): [/data/data/com.termux/files/usr/tmp/aapt2_24006682307500161125675915606835355288.tmp, compile, --dir, test/res, --legacy, -o, test/build/resources.zip]
	at brut.androlib.res.AaptInvoker.invoke(SourceFile:90)
	at brut.androlib.ApkBuilder.buildResources(SourceFile:357)
	at brut.apktool.Main.main(SourceFile:92)
Caused by: brut.common.BrutException: Execution failed (exit code = 2): [/data/data/com.termux/files/usr/tmp/aapt2_24006682307500161125675915606835355288.tmp, compile, --dir, test/res, --legacy, -o, test/build/resources.zip]
	at brut.util.OS.exec(SourceFile:147)
	at brut.androlib.res.AaptInvoker.invoke(SourceFile:87)
	... 2 more
W: /data/data/com.termux/files/usr/tmp/aapt2_24006682307500161125675915606835355288.tmp: 2: Syntax error: "(" unexpected

I could outline some of what I know about this issue so far:

  • apktool requires a special aapt2 with patches
  • The one that comes with it by default is for x86 GNU/Linux, so that is why that one has this error
  • The one that comes from pkg install aapt2 seems to not have the necessary version and/or patches needed by apktool
  • Source code of the required special aapt2 might be unavailable, and you might need to invent a new one from scratch to fix this

https://github.com/iBotPeaches/Apktool/raw/refs/heads/main/brut.apktool/apktool-lib/src/main/resources/prebuilt/linux/aapt2

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

Okay.

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

@robertkirkman Okay, I seem to have found a method. Can we achieve this by replacing the aapt2 binary file?
IMG_20260318_161319.jpg

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

xingguangcuican6666 commented Mar 18, 2026

Or rather, Should we update the aapt2 package?

@robertkirkman
Copy link
Copy Markdown
Member

Or rather, we should update the aapt2 package.

It may depend on this:

I have left other reviews in that PR.

I think that if you copy and paste that PR and try to update it to make your own version, that would be ok. The original creator seems to be afk.

@robertkirkman
Copy link
Copy Markdown
Member

@robertkirkman Okay, I seem to have found a method. Can we achieve this by replacing the aapt2 binary file? IMG_20260318_161319.jpg

what aapt2 did you replace it with?

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

It's from here https://github.com/ReVanced/aapt2

@robertkirkman
Copy link
Copy Markdown
Member

Good. If you can find a way to build that version in the Termux aapt2 package then that would be very good

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

I created a new pr. #28994

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

Is there a way to directly download the deb packages present in the official repository and extract the binary files?

@robertkirkman
Copy link
Copy Markdown
Member

Is there a way to directly download the deb packages present in the official repository and extract the binary files?

Yes, here is an example

curl -O https://packages-cf.termux.dev/apt/termux-x11/pool/main/d/dia/dia_0.97.2-p20260216-0_aarch64.deb
ar x dia_0.97.2-p20260216-0_aarch64.deb
tar xvf data.tar.xz
ls data/data/com.termux/files/usr/bin

@xingguangcuican6666
Copy link
Copy Markdown
Contributor Author

Okay, I think we should handle aapt's PR first before dealing with this, after all, it requires aapt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants