Apktool
Apktool copied to clipboard
[BUG] Decode and build apk but crashed when launch it
Information
- Apktool Version (
apktool -version) - latest - Operating System (Mac, Linux, Windows) - Mac
- APK From? (Playstore, ROM, Other) - Other
- Java Version (
java --version) - java 11.0.16
Stacktrace/Logcat
Steps to Reproduce
apktool dandapktool b- install it by command line ('adb install')
- launch it and crashed
Frameworks
If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)
APK
If this APK can be freely shared, please upload/attach a link to it. app-debug.apk.zip please remove the suffix '.zip' from this file name, it's a demo apk.
Questions to ask before submission
- Have you tried
apktool d,apktool bwithout changing anything? yes - If you are trying to install a modified apk, did you resign it? yes, install it successfuly, but crashed when launch
- Are you using the latest apktool version? yes, clone the latest source code and build it.
Well thats odd. If you use it with -s (without sources) does it work? It would suggest smali/baksmali is corrupting the file.
yes, if I use it with -s and it work.
Well thats odd. If you use it with
-s(without sources) does it work? It would suggest smali/baksmali is corrupting the file.
@iBotPeaches has any new discoveries
@iBotPeaches I have found that cause, here:
// In case we have no resources. We should store the minSdk we pulled from the source opcode api level
if (!mApkInfo.hasResources() && mMinSdkVersion > 0) {
mApkInfo.setSdkInfoField("minSdkVersion", Integer.toString(mMinSdkVersion));
}
Add a condition likes:
// In case we have no resources. We should store the minSdk we pulled from the source opcode api level
if (!(mApkInfo.hasResources() && mConfig.forceDecodeManifest == Config.FORCE_DECODE_MANIFEST_FULL)
&& mMinSdkVersion > 0) {
mApkInfo.setSdkInfoField("minSdkVersion", Integer.toString(mMinSdkVersion));
}
If not decode manifest, we can not get minSdkVersion. So build the dex with incorrect minSdkVersion(dex version).
@wangnianwu - You are welcome to open a PR with some reasoning. Its tough to follow samples in issues as it might not reflect the present state / context of code around it.