yashsingh1/xdaforums huggingface dataset:
[Android Software Development] vjb10:
Any suggestion of what should i learn first before trying to use this or can i just go for it? Thank you
[Android Software Development] Thebear j koss:
Just go for it. I had no experience with computers, commands, or anything relating to android modifying. Just read up on it, set up your path, install your necessary files, and start decompiling and modifying.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] vjb10:
Allright then, i'll do it. Thanks a lot buddy
[Android Software Development] Thebear j koss:
Believe me, if I can do it, anyone can learn to do it. Learn to read and understand logs as well as they are always the best way to find mistakes or errors. Don't get discouraged either, I am terrible with grammatical errors and often would take many tries to fix my own stupid mistakes before stuff worked.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] vjb10:
I know i'm asking too much but i was trying to use apktool and did some things there. After that i downloaded Android studio (Android SDK manager included) but i don't know where to open it. I tried a lot but couldn't figure it out. Can you give me some help with that? Thanks and again, sorry for asking too much
[Android Software Development] MishaalRahman:
I updated to the latest APKtool version and have the latest framework file from O DP3 taken from a Pixel XL. Yet I am still unable to decompile Google Maps, for example, version 9.55. I know it should be possible as AndroidPolice was able to do so: http://www.androidpolice.com/2017/0...ps-for-whole-countries-apk-download-teardown/

Any ideas?
[Android Software Development] Thebear j koss:
Post the log

—————Who am I doing this for, hey me or you? ————
[Android Software Development] MishaalRahman:
Here you go: https://pastebin.com/raw/i1sB4cTE
[Android Software Development] Thebear j koss:
It decompiled, there is no error or fail there are some things that weren't decoded but you should have a decompiled apk...

—————Who am I doing this for, hey me or you? ————
[Android Software Development] MishaalRahman:
Those things that weren't decoded are what I'm looking for.
[Android Software Development] Thebear j koss:
That wasn't what you said, you said you could not decompile. The apk decompiled, i can't help with undecoded files.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] MishaalRahman:
Alright, my question was badly worded. But any idea why these files aren't decoding? It must be possible if that AndroidPolice guy did it.
[Android Software Development] Thebear j koss:
How do you know he got those to decode? They just diff merge out the changes between new and previous versions. The new stuff they look for are in layouts and other folders is res

—————Who am I doing this for, hey me or you? ————
[Android Software Development] Thebear j koss:
Keep original signature.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] SKULSHADY:
Thanks. It worked
[Android Software Development] iBotPeaches:
AndroidPolice actually no longer uses apktool. I bet some staff does, but they have a license (or did) for JEB, a pretty expensive enterprise decoder. Its resource engine I think started as apktool in version 1, but was rewritten later so excels in some places where apktool fails.

Not looking good. This Kotlin application first type in the system is "anim" instead of "attr" which is causing major problems. More details here - https://github.com/iBotPeaches/Apktool/issues/1520#issuecomment-312092301
[Android Software Development] MishaalRahman:
Wow, thanks for the response. I'm surprised they are using that just for APK teardowns. But I guess it currently gives them an edge with apps targeted to the new SDK version.

Would JEB be able to decompile Huawei APKs you think? There's a lot I wanted to do with those.
[Android Software Development] vjb10:
How can i open .db files? Thanks
[Android Software Development] Thebear j koss:
With a database editor. Rom toolbox had 1 built in. Used to use it to change boot sound on the galaxy s 3.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] vjb10:
Hey, i used DB Browser and it worked and i have another doubt know. Is there anyway i can find out an encryption key from an apk file database? Thank you
[Android Software Development] iBotPeaches:
I've discovered the issue plaguing more and more applications daily. These applications that are failing with "First type is not attr!" was built with the aapt2 binary - https://developer.android.com/studio/preview/features/new-android-plugin.html

This allows all those cool enhancements in Android Studio, but we cannot rebuild an application originally built with aapt2 in aapt1. In order to stay sane, all future updates regarding this bug will be here - https://github.com/iBotPeaches/Apktool/issues/1520
[Android Software Development] mananpa:
Hi, Apk tool will support kotlin?
[Android Software Development] iBotPeaches:
It already does as of 48 hours ago.
[Android Software Development] Phone_Guru:
Getting the following error when trying to build the latest version

> Configure project :

Building SNAPSHOT (no .git folder found)

Updating license header in: brut.j.common\src

Updating license header in: brut.j.common\src

Updating license header in: brut.j.common\src

Updating license header in: brut.j.common\src

Missing header in: brut.j.common\src\main\jav

Missing header in: brut.j.common\src\main\jav

Missing header in: brut.j.common\src\main\jav

Missing header in: brut.j.common\src\main\jav

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':brut.j.common:lic

> License violations were found: C:\Users\Ila

nknownFileException.java,C:\Users\Ilan\Downlo

xception.java,C:\Users\Ilan\Downloads\Apktool

on.java,C:\Users\Ilan\Downloads\Apktool-maste

* Try:

Run with --stacktrace option to get the stack

BUILD FAILED in 2s

7 actionable tasks: 4 executed, 3 up-to-date

Any ideas?
[Android Software Development] iBotPeaches:
There was a 6 minute period where I enabled license header checks and before those fixed license files were in the repo. Looks like you found those 6 minutes.
[Android Software Development] Phone_Guru:
Knew I was special.
[Android Software Development] AL_IRAQI:
Hey buddy, it nice to see you here, i remember using your theme on S4

Cheers :highfive:
[Android Software Development] MishaalRahman:
Edit: nvm
[Android Software Development] Phone_Guru:
Still getting the same error when building
[Android Software Development] Spannaa:
Yep, me too.
[Android Software Development] iBotPeaches:
Both of you building on Windows? I see I accidentally hard coded the license location with unix style paths - https://github.com/iBotPeaches/Apktool/blob/master/build.gradle#L46 I may need to update this for all operating system support.
[Android Software Development] Phone_Guru:
I'm building on windows
[Android Software Development] Spannaa:
Yep, on Windows here too. I'll give it a go on my Linux laptop later.

[EDIT] Built successfully on Linux :) [/EDIT]
[Android Software Development] adrenochrome25:
-c,--copy-original use/usage & system apks

just a little question, i have a very light modification to do on an apk so i extract with :

apktool d -s -r miuisystem.apk

i modify my xml file in assets/device_features/

and i build with :

apktool b -c miuisystem

since it's a system apk, i have read i should keep the original signature with the -c,--copy-original flag

but if i check the signature(v1 scheme since it is Marshmallow), with jarsigner or apksigner, it fail with SHA1 mismatches for every file in MANIFEST.MF

in many places it's written that if you do any modification you are obliged to resign the apk, but then it's not clear to me what is the use of the -c,--copy-original ?

what is the correct way of editing a system apk ?

edit : the original apk just pulled with adb has already the same signature error !?! i'm lost .... miui signatures are specifics ?
[Android Software Development] :
Just open the zip and remove meta-inf and androidmanifest

And add it from original one
[Android Software Development] Spannaa:
I'm pretty sure MIUI still isn't supported by apktool.
[Android Software Development] iBotPeaches:
I've open a bug internally - https://github.com/iBotPeaches/Apktool/issues/1553 , not as easy as I expected. It seems the plugin I use for license checks has a line ending problem with windows, or rather the difference in line endings between unix & windows.

This is generally the reason I'm thinking of deprecating `-c`. The idea early on was to automate the procedure of "injecting" modified contents into the original apk. This process kept the signature and Manifest together and didn't care about other modified files. However, as Android evolved checks were enforced this became more difficult. You can test this by taking a basic apk. Modify the classes.dex file and re-inject it into the original apk. Do not touch the signature. Try that APK on Ice Cream Sandwich and up. Notice around Marshmallow the APK is rejected. This isn't v2 scheme, this is simply enforcement of the v1 signature scheme. I'm referring to standard AOSP as well here, not modified XDA Roms that sometimes remove security checks.

MIUI is an interesting dilemma, as they modify resources they additionally modified how applications are loaded. It must have been for their ROM Virus Scanner or something, but you won't experience the same APK loading as you do with the corresponding MIUI release as they change things.
[Android Software Development] djdarkknight96:
System apps need to go back on system, I think your trying to install with package installer? Grab fresh apk and from build folder and just drop in assets folder or whatever you edited. Use 7 zip it will keep system apk signature. Then adb push it back to system. Reboot

Hope that helps

DJ
[Android Software Development] adrenochrome25:
ok thanks :)

in fact that's what already do the -c flag from apktool

but who will update the sha1 checksums values ?

in META-INF/MANIFEST.MF you have an entry for each file contained in the apk with a SHA1 checksum value

if i edit a file from the apk, his checksum will change and it will create a mismatch with the value inside MANIFEST.MF

and jarsigner&apksigner detect it :/

i suppose the apk may work, but how can i verify the signature validity if jarsigner&apksigner fail ?

#checking signature validity with jarsigner
$ jarsigner -verify -verbose -certs ./miuisystem.apk
jarsigner: java.lang.SecurityException: SHA1 digest error for assets/device_features/aqua.xml

#checking signature validity with apksigner with filter because output report ALL file checksums are wrong
$ ~/android/android-sdk-linux/build-tools/25.0.3/apksigner verify miuisystem.apk 2>&1 | grep aqua.xml
ERROR: SHA-1 digest of assets/device_features/aqua.xml does not match the digest specified in META-INF/MANIFEST.MF. Expected: <h4nGWoEeaLcwshSZNhG7tJd1HNo=>, actual: <FxqHmA7VhhV0f6y3Dmykb+SN/VI=>

#checking MANIFEST.MF checsum value
$ grep -A1 aqua.xml MANIFEST.MF
Name: assets/device_features/aqua.xml
SHA1-Digest: h4nGWoEeaLcwshSZNhG7tJd1HNo=
[Android Software Development] :
That's not an issue. It just tells u u modified the file. And it differs
[Android Software Development] adrenochrome25:
ok, but the verification fails :

$ jarsigner -verify miuisystem/dist/miuisystem.apk
jarsigner: java.lang.SecurityException: SHA1 digest error for assets/device_features/santoni.xml
$ echo $?
1

and after correcting the value in MANIFEST.MF it doesnt fail anymore :

$ jarsigner -verify miuisystem/dist/miuisystem.apk
jar verified.
...
$ echo $?
0

so ... can i say the SHA1 checksums are not used for system apk you directly put in the phone, they are only used for installable apk ?

but perhaps apktool "-c" flag could be improved to automatically update the sha1 values in MANIFEST.MF, maybe i should open an issue on github

---------- Post added at 07:20 PM ---------- Previous post was at 07:16 PM ----------

no, i only wanted some confirmation of the apk validity before putting it on the system from recovery and to minimize risks of android boot troubles

---------- Post added at 07:28 PM ---------- Previous post was at 07:20 PM ----------

thanks for your very detailed answer, i noticed there seems to be non standard behaviour with miui, as soon as i decode sources or resources i get frightening warning when rebuilding apk, i'll confront this problem later ;)
[Android Software Development] djdarkknight96:
Lol, I've done it like this for many many years no issues with it.
[Android Software Development] bigfoot2047:
missing functionality after SystemUI rebuild

Hi, i'm trying to mod a SystemUI for a 5.1.1 car system.

I loaded the framework-res.apk and SystemUI.apk as required.

after rebuilding --without any changes-- i'm getting some missing functionality - no status bar.

during the build i get a few "W: warning: string 'X' has no default translation." errors.

main question is why is the 'no-changes' rebuilt version working differently.

i assume some framework is missing, no idea how to progress.

version:

Apktool v2.2.3 - a tool for reengineering Android apk files

with smali v2.2.1 and baksmali v2.2.1

attached APKs, would appreciate any direction.
[Android Software Development] Thebear j koss:
Most likely a signature issue. Warnings are not errors and usually can be ignored. Not sure if there are differences between car and device apks but I presume apktool would work either way. My guess would be the signatures would all need to match throughout the system.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] thereassaad:
He need to install the correct framework-res.apk & tw-framework-res.apk or samsung-framework-res apk etc or what called for others devices fw that he used then he can recompile systemui.apk fine , without the corrected both res apk installed his issues its normally ..

sent From 920F Powered by Eragon
[Android Software Development] AndrewR777:
apktool online

To make things easier, I just put the apktool online: javadecompilers.com/apktool

Some limitations, obviously, exist due to the service ‘online nature’: you may extract and research assets and the manifest file, but it is impossible to recompile the application at the moment...

Still, this is a no-hassle way to 'open' the android application, so I hope some people would find it useful.

Any input/comment/feedback would be highly appreciated.
[Android Software Development] bigfoot2047:
thanks for the reply.

i verified the signatures and it looks like original apk was signed with the test keys so nothing changed.

i'm also zipaligning the apk, here's the full process:

0. apktool if framework-res.apk; apktool if SystemUI.apk

1. apktool d SystemUI.apk

2. apktool b -f SystemUI -o SystemUI.apk.unsigned

3. java -jar ../SignApk/signapk.jar -w ../SignApk/testkey.x509.pem ../SignApk/testkey.pk8 SystemUI.apk.unsigned SystemUI.apk.signed

4. ~/Android/Sdk/build-tools/26.0.0/zipalign -f 4 ./SystemUI.apk.signed ./SystemUI.apk.signed.zipaligned

then i use an update.zip to install the new SystemUI.apk and it doesn't run (no status bar).

is there any log for the system startup where i can understand what it failed on?

---------- Post added at 11:17 AM ---------- Previous post was at 11:12 AM ----------

Hi, i hope you were referring to my question.

there are no additional apks in /system/framework or /data, i also tried apktool-ing all apks in the vendor folder to check the apktool.yml isFrameworkApk:

couldn't find any additional framework apks.

any other places we can find them? (or check the SystemUI.apk which frameworks it needs?)
[Android Software Development] zelendel:
Hook it up to a pc and run a logcat while it boots. This will tell you what is broken.

Also keep in mind guys. Many people are now encrypting the apks. So decompiling them will not work. A perfect example are susbstratum themes, handcent, and many others.
[Android Software Development] bigfoot2047:
thanks for your reply. i will try to get it connected to a PC (not trivial since it's a car system).

re encryption - smali files are readable and make sense (that's what i'm trying to edit) - is that a good enough indication this SystemUI isn't encrypted?

another question - unzipping original APK and rebuilt APK i get a LOT of diffs (almost every file in res folder, and drawable-hdpi changed it's name to drawable-hdpi-v4)

could the v4 thing indicate some version mismatch? is there any way to verify the version and force apktool to build with that version? (the system is 5.1.1)

thanks!
[Android Software Development] zelendel:
That is a slippery slope to be honest. Messing with this could mess your car up in unexpected ways. Remember that that this whole thing is tied to your cars main computer.

I doubt the system ui is encrypted. Unzipping an apk is a bad idea as too many variables. The zip program and how the apk was built. All can give you different outcomes.

I would get a laptop handy if you are gonna do this as there will be many times you will need it.

As for smali. Well that is barely readable.
[Android Software Development] Thebear j koss:
Build keeping original signature. Do not use test keys to sign it.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] bigfoot2047:
many thanks. i went again to:

https://xdaforums.com/showthread.php?t=2478761

and followed it to the letter - now everything works!

(originally i missed the zipalign and after that bad signature + zipalign didn't work)

thanks again everyone for the fast responses!
[Android Software Development] ale5000:
Hi,

is it possible to have a command-line flag to decode / encode only some resources instead of the entire apk?
[Android Software Development] Ticklefish:
What do you want to decode?

---------- Post added at 06:55 PM ---------- Previous post was at 06:11 PM ----------

What do you want to decode?
[Android Software Development] ale5000:
I would like to decode just "res/values/arrays.xml" and "res/values/bools.xml" from framework-res.apk, modify and reencode changing the minimum possible of the file and leave the rest intact.

Is it possible?

If it not possible with single files maybe just with the res/values/ folder?
[Android Software Development] Spannaa:
The res/values folder is resources.arsc decoded.
[Android Software Development] ale5000:
How can I decode only resources.arsc?
[Android Software Development] Thebear j koss:
Why would you? The whole apk gets decompiled and you change whatever you like. Only what changes you make will be built into the compiled apk. You can just ignore all the other files that are in the apk.

—————Who am I doing this for, hey me or you? ————
[Android Software Development] Spannaa:
You can't.

resources.arsc contains files which reference other files that aren't in the res/values folder so recompiling would error if these files weren't present.

Decompile your framework-res.apk, edit the arrays.xml & books.xml, recompile and then open the original apk with 7-Zip and replace the original resources.arsc with the edited version.
[Android Software Development] iBotPeaches:
As said by everyone else here, this is not possible. res/values files are inflated from the decode of the resources.arsc file. While decoding that file, it makes sense to unpack the rest as you can't partially unpack resources.arsc, because partially updating that file seems like a nightmare of fixing string blocks and more.

Files that lay in the application (layouts, images, etc) have no purpose or association without also decoding resources.arsc, so you basically need to decode everything. The only exception to this rule is AndroidManifest.xml as you could technically decode that using only framework resources. This of course depends per application as app developers can use [MENTION=936943]string[/MENTION] references all over the manifest, which would require decoding the resources to get those string references.
[Android Software Development] e-cl:
Gentlemen, i need a little assistance. I can't decompile a file, it always give me this:

Exception in thread "main" java.lang.NullPointerException

at brut.androlib.res.data.value.ResFlagsAttr$FlagItem.getValue(ResFlagsAttr.java:158)

at brut.androlib.res.data.value.ResFlagsAttr.serializeBody(ResFlagsAttr.java:83)

at brut.androlib.res.data.value.ResAttr.serializeToResValuesXml(ResAttr.java:64)

at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:518)

at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:268)

at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:132)

at brut.androlib.ApkDecoder.decode(ApkDecoder.java:115)

at brut.apktool.Main.cmdDecode(Main.java:166)

at brut.apktool.Main.main(Main.java:81)

[*] ---> Error decompiling HwCamera.apk

Java 1.8. tried different versions of apktool, yet no luck.

Apk is in the attachement.

What could be the reason for this?
[Android Software Development] Thebear j koss:
What framework did you install?

the stronger the tide, the harder I will swim.
[Android Software Development] e-cl:
Uploaded framework files here, https://ufile.io/mdpzh , too large to attach to post
[Android Software Development] djdarkknight96:
What device did this come from? Have you installed framework from it like Bear asked?
[Android Software Development] e-cl:
It is from Huawei 4c / y6ii / p8 lite, they're all the same. Sure i installed both framework files, however, this strange error occures.
[Android Software Development] lieuliau:
Is there anyway to edit Manifest without decompile resoures?
[Android Software Development] Spannaa:
Probably not/
[Android Software Development] lieuliau:
Can you show me how to decompile only AndroidManifest.xml? I'd like to try.
[Android Software Development] Spannaa:
I've never tried this but, if you deleted the res folder, resources.arsc and classes.dex from the apk and then decompiled it, you should end up with a decoded AndroidManifest.xml.

As [MENTION=3924617]iBotPeaches[/MENTION] mentioned though, there'd probably be a load of missing resource references.

Why do you want to decode just AndroidManifest.xml anyway?
[Android Software Development] edzamber:
Why delete all stuff ? Just Decompil apk, modify androidmanifest, recompil with New signature then drag and drop recompiled androidmanifest from recompiled apk to original one with 7zip...
[Android Software Development] Spannaa:
Yes, but [MENTION=1683663]lieuliau[/MENTION] asked how to decompile only AndroidManifest.xml ;)
[Android Software Development] edzamber:
Right, and i answered to him from your quote [emoji23]
[Android Software Development] djdarkknight96:
Editing manifest, it will not stick on system. Signing it and install may work but editing manifest usually causes issues. If it's something simple like a style it can be edited in smali. Find the controlling smali and search OnCreate. Then you can place a theme reference there and it will ignore manifest style.
[Android Software Development] edzamber:
You're right but sometimes AndroidManifest have to be edited as for exemple remove ota and Webmanual in Nougat SecSettings...

But in this case it need to Disable Signature Check in frameworks
[Android Software Development] lieuliau:
I need to add permission in Manifest, but yesterday, I encounter an apk that won't allow me to recompile except I decompile without resource, then it works. So that's why I ask how to decompile Manifest only :) If there is any modification in source code allow that, I would like to try too [MENTION=3924617]iBotPeaches[/MENTION]
[Android Software Development] zelendel:
Many apps and themes (mostly themes) are starting to encrypt their files so they can't be decompiled and recompiled. I know ow handcent is one of them. Even if it did the files were corrupted and wouldn't work.
[Android Software Development] djdarkknight96:
Nah you'll have to decompile the entire res for manifest to decode. It uses resources in res so it will need to decode them so you can see what they are.
[Android Software Development] mjraogr:
Also tried using other api and other framework causing same issues in aapt. The sdk is installed and patched, Java 8 etc..