Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix abi issue #10

Open
KingMahmud opened this issue May 1, 2022 · 18 comments
Open

Fix abi issue #10

KingMahmud opened this issue May 1, 2022 · 18 comments

Comments

@KingMahmud
Copy link

Compile odex and vdex per the instruction set app uses.
Example :
When an app contains arm7 binaries, it compiles odex and vdex with arm7 instruction set.
I am on Arm64 device and trying to do odex patching an app which only contains arm7 binaries. I patched the odex but seems it didnt work, i troubleshooted a bit and found that there was a created a new folder at oat dir, arm64.
But it should compile odex vdex as arm7 not arm64.
Kindly check out the issue

@giacomoferretti
Copy link
Owner

Thanks for opening the issue! Can you give me more information to work with?

  • App's version
  • Android version
  • ABI
  • Device manufacturer (Pixel, Samsung, etc.)
  • ROM (Stock, AOSP, TouchWiz, etc.)
  • Original APK and modded apk (optional)
  • Logcat (optional)

@KingMahmud
Copy link
Author

App's version : 2.0.0 rc 1
Android version : 10
ABI : arm64-v8a, armeabi-v7a
Device manufacturer : Samsung
Rom : Stock
Original APK : use any apk which has armeabi-v7a binaries

@KingMahmud
Copy link
Author

https://github.com/giacomoferretti/odex-patcher/blob/main/app/src/main/java/me/hexile/odexpatcher/art/Art.kt

Field : CPU_ABI

It should not be like this as instruction set used by the app we are patching may be different.
Example :
some.apk -> libs/armeabi-v7a/*
In this case even if the device is arm64, the app will run on arm instruction set.

I hope my point is clear.

A possible solution : "base.apk" -> parent file -> + /oat -> arm64 or arm or x86 ...

@giacomoferretti
Copy link
Owner

Wait, you mean compiled ".so" libraries?

@KingMahmud
Copy link
Author

Wait, you mean compiled ".so" libraries?

Yes

@giacomoferretti
Copy link
Owner

Odex Patcher doesn't touch shared libraries, I don't understand what the problem is.

Can you give me the APK that you have problem with, so I can replicate it and fix it?

@KingMahmud
Copy link
Author

Okay here is a dummy apk.
System requirement : arm64 device
via-release_sign.apk.zip

Remove .zip extension and it will be installable

@KingMahmud
Copy link
Author

Now try patching the odex, you will see :
Before :
/data/app/mark.via.gp/oat/arm/.oat|.vdex

After :
/data/app/mark.via.gp/oat/ ->
arm64/.oat|.vdex
arm/.oat|.vdex

Here the arm64 folder contains patched oat, while the app uses arm one.
Reason : the app is using arm native binaries and because of that it will compile oat to same.

@KingMahmud
Copy link
Author

I would have sent a PR with fix for these issues but the project is in kotlin and i am a java person😄.
I am not that good with kotlin, so i decided not to ruin your code.

@giacomoferretti
Copy link
Owner

Now try patching the odex, you will see : Before : /data/app/mark.via.gp/oat/arm/.oat|.vdex

After : /data/app/mark.via.gp/oat/ -> arm64/.oat|.vdex arm/.oat|.vdex

Here the arm64 folder contains patched oat, while the app uses arm one. Reason : the app is using arm native binaries and because of that it will compile oat to same.

I have never encountered such a case, but now I understand better. I will try as soon as possible, thank you!

I would have sent a PR with fix for these issues but the project is in kotlin and i am a java personsmile. I am not that good with kotlin, so i decided not to ruin your code.

Don't worry, currently the code is very messy, so it's not a problem if it's not good, in case I'll fix it later. 😉

@KingMahmud
Copy link
Author

Thanks!
I hope there will be a quick fix and update ;)

@giacomoferretti
Copy link
Owner

I have found the problem and am starting to write the fix. I need to rewrite the ISA "detection".

@KingMahmud
Copy link
Author

Yeah, removing dependence on CPU_ABI would fix it.
CPU_ABI doesn't hold any importance except for setting ISA, ISA can be known from :
"base.apk" -> parent file -> + /oat -> arm64 or arm or x86 ...

@giacomoferretti
Copy link
Owner

I don't want to go that way, because in the rare case that the app is not already optimized, there is no oat folder. I would check if has native lib, like Android does, and if not, fallback to CPU_ABI.

@KingMahmud
Copy link
Author

Okay, that seems plausible ;)

@KingMahmud
Copy link
Author

Any updates?

@giacomoferretti
Copy link
Owner

Not yet, I was working on it in September, but now I have to study.

You can check the progress here: https://github.com/giacomoferretti/odex-patcher/tree/dev

It's almost a complete rewrite, because the structure wasn't optimal.

@KingMahmud
Copy link
Author

Okay!
Have good time studying :)

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

No branches or pull requests

2 participants