-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
YouTube 14.50.53 xxhdpi apk does not recompile correctly #2264
Comments
I should add that the xmls the error refers to seem to have no issues so this error is indeeded very perplexing |
I can't try it on an Android device (I haven't got one right now and Santa didn't give me one for some reason) but I was able to recompile that APK without any trouble at all. |
The problem is that it recompiles, but doesn't want to run at all. I don't really know what's the problem, but as @KevinX8 said, it refuses to start up. |
The issue isn't that it doesn't recompile but that the recompiling causes the files to change in an unintended way causing the app to crash on startup (logcat included in original post) and that's what I meant by "correctly". I am unsure of what apktool does to the apk that causes it to crash on startup as the logcat refers to an XML that has no obvious issues in it and seems to match decompilations of previous versions of the app that do not crash (eg. 14.41.xx) |
Hmm. I see your point. And the one I uploaded has the same problem? |
Uh I just checked out your file and what you actually uploaded was an xapk/apks not an apk, and the apk files inside are not touched, maybe I should have expanded the instructions a little. Basically YouTube is now a split apk so you have to extract the xapk first (using 7zip or whatever you want) and then decompile the apks inside (the issue lies in the apk named com.google.android.youtube.apk aka the base apk) then after you have done the changes you wanted or in this case no changes you sign each apk with the same signature. Then you install the files loose using Split Apk Installer or rebundle them into a zip and change extension to .apks . This process works for other split apk apps just fine. So if you want to replicate the issue you have to recompile the base apk with apktool and then sign all the apks inside with the same signature. |
Put in my two cents for someone with more time to check: This is one of those cases where the useful exception is at the bottom of the stacktrace:
This shows that the issue is the attribute value ?ytOverlayBackgroundMedium, not the xml file. A quick google search of that exception suggests this is something with missing attribute values, but all solutions refer to adding elements to the code. Perhaps finding and adding the missing elements works as a workaround, but not as a final fix. |
Oh, it's an APKS. I know about these but I haven't had any practical experience with them, so I can't really help here. Sorry. By the way, I took a look at bundletool. There doesn't seem to be any way to bundle a collection of APK files. All I can find was instructions to bundle an AAB made by Android Studio. What command are you using to rebundle them? |
Oh sorry I assumed bundletool could create them from loose apk, personally I've just been zipping them up and using https://github.com/Aefyr/SAI to install them, technically speaking a .apks file is just a zip file containing the apk files https://fileinfo.com/extension/apks , so making a zip with the apk and renaming it to .apks should work with tools other than SAI aswell. |
I've extracted all the files from the APK shared in the OP, decompiled all the resulting APK files (with a "framework-res.apk" from Android 10 AOSP installed), recompiled them with aapt (aapt2 gives errors) and zipped the new APK's in a new file. I also added the PNG and JSON file from the original APK. Lastly I renamed the ZIP as an APK and also made a copy as an APKS just to see what happens. These two files are here: https://www.mediafire.com/file/121stpk7jg7dpzc/YouTube_Test_001.apk/file and https://www.mediafire.com/file/121stpk7jg7dpzc/YouTube_Test_001.apks/file I'm not saying these will definitely work or anything like that. This is very much an experiment. But could somebody please try them out and let me know if they work or not? You'll probably need to copy and paste the links. |
Did you sign each individual APK file with the same signature? Or it still needs to be signed? Also renaming an apks as apk won't let you install it with package installer you'll still need to use adb/bundletool or SAI to install it. The OP links to an xapk which is almost the same as apks but is slightly customised by apkfab for their own purposes, it seems the usual bloat free apk mirror sites such as apkmirror still lack support for apks. |
I used the original signature. No changes, just decompiled and recompiled. I can certainly try with a new key if it the file doesn't install. |
Just an FYI, -c won't work with split apks, luckily SAI has a resign apks feature tho :D |
Always good to learn something new. :) |
After some heavy analysis we figured out that the issue is not the base apk but actually the xxhdp apk, when that gets decoded and recompiled it causes the error to occur. |
issue is related to #2218 , closing as it's basically a duplicate, the solution until apktool fixes it themsleves is to use #2218 (comment) or #2218 (comment) |
Information
apktool -version
) - v2.4.1-c20659-SNAPSHOTStacktrace/Logcat
Steps to Reproduce
If the apk is just resigned without decompiling and recompiling the above crash doesn't occur
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://apkfab.com/youtube/com.google.android.youtube
Questions to ask before submission
apktool d
,apktool b
without changing anything? Yes The issue occurs even with 0 changesThe text was updated successfully, but these errors were encountered: