Open peret opened 2 years ago
Does adb logcat
have anything before that crash? Otherwise my guesses are:
There are no other relevant logs as far as I can tell, I will double-check tomorrow though.
Could you please elaborate a little on your second guess? I'm not sure I understand what the problem would be, i.e. what exactly do you mean by resources "that can no longer be public"? Also, how would you determine whether this is indeed the issue, i.e. how would this manifest in the output of decode or the rebuilt APK?
Did you repackage the APK without modifying the underlying dex code? Decoding and repackaging the APK with or without --no-src
shouldn't make any difference IMO, or does smali/baksmali
fail during decoding/re-assembling?
Did you repackage the APK without modifying the underlying dex code?
Exactly, I did not modify the dex/smali code in any way. Any difference in the dex files is only due to apktool decompiling + recompiling the files.
Decoding and repackaging the APK with or without
--no-src
shouldn't make any difference IMO, or doessmali/baksmali
fail during decoding/re-assembling?
Yes, that's what's so weird about it. It shouldn't make a difference, but it does. Decoding and building is not a problem, the app crashes during runtime.
Speaking of differences:I can see that there are differences between the binary dex files before and after decompiling+recompiling. I assume some differences are to be expected though?
I have to double check that first.
You are right. Using baksmali d
and smali a
will lead to a different dex file in terms of size (bigger). This applies only the first time, i.e. if you iteratively call the two commands the resulting dex file will be of the same size. I have no idea what it is, but I would guess some sort of optimization that dx/d8
can perform and baksmali
is not capable of. @JesusFreke, you know what's going on here?
I've seen that apps with explicit static boolean x = false
get turned into static boolean x
(with implicit false).
The same goes for static int x = 0
.
I also see (uncompressed) data getting bigger.
Information
apktool -version
) - 2.6.1Stacktrace/Logcat
Steps to Reproduce
apktool decode
apktool build
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -storepass ${PASS} -keystore ${KEYSTORE} ${OUTPUT_DIR}/unaligned.apk key_alias
${ANDROID_HOME}/build-tools/27.0.1/zipalign -f 4 ${OUTPUT_DIR}/unaligned.apk ${OUTPUT_DIR}/aligned.apk
${ANDROID_HOME}/build-tools/27.0.1/apksigner sign --ks ${KEYSTORE} --ks-pass ${PASS} --ks-key-alias key_alias ${OUTPUT_DIR}/aligned.apk
Frameworks
N/A
APK
Unfortunately, I'm not allowed to share the APK :/
Questions to ask before submission
apktool d
,apktool b
without changing anything? - YesHi @iBotPeaches 👋
So, I have this APK that I tried unpacking and repacking. Decoding, building, and installing are no problem, but when I try to start the app, it fails with one of two exceptions. One is the BUS_ADRALN I pasted above. The other one is a SEGFAULT and looks surprisingly similar to the one in this old issue. (Or at least the fault addr 0000002b is the same. Not sure if that means much, I can try to get and paste my other stacktrace as well, if it helps.) The APK includes a lot of native code/libraries and at first I thought that might be related to the issue, but
extractNativeLibs
is true and using the-p
flag to page align .so-files with zipalign doesn't make a difference.What does make a difference is using
--no-src
for the decode step! The app starts without issue, when I decode and build without decompiling the dex files. Unfortunately, I need to be able to modify the .smali files, so using this flag is not really an option in my situation.I'm wondering whether you have seen this before. I realize there is not much to go on, since I can't share the APK here, but if you can give me any pointers on what to look into, that would be extremely helpful.
Thank you, as always!