AndroidManifest.xml (and maybe other) problems - G1 Q&A, Help & Troubleshooting

Hi all,
I modifed an app so that it would run on my phone--I have a cyanogen ROM, and it doesn't play well. The app runs fine on my wife's stock G1. Anyway, I used baksmali and smali to make the necessary changes, and it recompiles fine. I also "decrypted" the AndroidManifest.xml (from binary to text), resigned the package, and I get the dreaded "file does not contain AndroidManifest.xml" error.
Apparently, the AndroidManifest.xml doesn't get built back to its binary mode during the package signing.
1. How do I get AndroidManifest.xml back into its proper binary format?
2. Is there anything else I am missing?
Thanks.

The XML files are converted during the process of building the .apk file, i.e. by "aapt". You can do this manually if you want.
http://developer.android.com/guide/developing/tools/aapt.html

derfolo said:
I also "decrypted" the AndroidManifest.xml (from binary to text)
Click to expand...
Click to collapse
By what means did you accomplish this? Did you use aapt or did you do it manually?

lbcoder,
There is a handy tool to do this called AXMLPrinter2.jar. It is available here:
http://code.google.com/p/android4me/downloads/detail?name=AXMLPrinter2.jar&can=2&q=
I am having problems using aapt to "binarize" only the AndroidManifest.xml file. I can't package the entire app, because the baksmali files are not recognizable by Eclipse as java files, and when I use smali, it is all converted back into classes.dex. Any ideas?

Just to be clear, I am doing:
Code:
./aapt package -z -u -A ./app.directory -F ./app.name.apk
An .apk file pops up with no errors, but: 1) AndroidManifest.xml is not converted to binary, and 2) the same error "does not contain AndroidManifest.xml" occurs.
Thanks for any help.

Related

[Q] How to edit framework-res.apk?

I'm trying to edit framework-res.apk so I can theme my rom. Are these the correct steps?
pull framework-res.apk from my phone
decompile the apk
make the changes
rebuild the apk
sign
zipalign
push apk back to device
I'm not too sure on this method as after I pushed back my modified apk, I get a load of force close errors
Any advice would be welcome
don't sign and don't zipalign and all are fine
I tried without sign and zipalign but the rom wouldnt boot. If I sign, I get force close errors
Does the rom need to be deoxed?
How is your process to decompile and recompile what tools do you use
vibez said:
I tried without sign and zipalign but the rom wouldnt boot. If I sign, I get force close errors
Does the rom need to be deoxed?
Click to expand...
Click to collapse
Sent from my GT-I9000 using XDA App
Is this an ODEXed ROM or a deOXEDed ROM? You can't mix and match. If you're not ODEXing any APKs after you've modified them then you need to make sure all APKs are deOXEDed.
setenza01 said:
How is your process to decompile and recompile what tools do you use
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
I use apk manager to decompile and rebuild
Benjamin Dobell said:
Is this an ODEXed ROM or a deOXEDed ROM? You can't mix and match. If you're not ODEXing any APKs after you've modified them then you need to make sure all APKs are deOXEDed.
Click to expand...
Click to collapse
It is a stock rom but there is no framework-res.odex does that mean it doesn't need deodexing even though there are odex files for every other apk in my system folder?
maybe this little monster is some help to you:
http://forum.xda-developers.com/showthread.php?p=7377678#post7377678
FadeFx said:
maybe this little monster is some help to you:
http://forum.xda-developers.com/showthread.php?p=7377678#post7377678
Click to expand...
Click to collapse
Nice app but this theme also needs .xml changes which this app doesnt support
ok, i put him a note in his thread about the xml changing issue, we will see what hes answer will be...
edit:
also this software could do the trick: http://android.modaco.com/content/t-mobile-pulse-pulse-modaco-com/302404/ande-android-design-editor/
I've been playing around a little more today and it seems the issue is that no tool can rebuild the xml files correctly, they seem to be compressed/encoded.
Has anyone been able to edit an xml file in framework-res.apk and have the phone read it properly?
vibez said:
I've been playing around a little more today and it seems the issue is that no tool can rebuild the xml files correctly, they seem to be compressed/encoded.
Has anyone been able to edit an xml file in framework-res.apk and have the phone read it properly?
Click to expand...
Click to collapse
Refer to my signature. Apk manager.
Edit : just read ur op.
Never sign the system apk's. Simply keep the original signatures intact and after recompiling them, re-include them.
So here are the rules u must follow :
If u've modified the manifest.xml, u must stop core, push the apk, start core or push the apk while in recovery.
If u've modified anything else, a simple push / reboot will do the trick.
Note, u cannot flash a modified system apk the first time (as in on a clean boot), u must flash the original rom, let it build the dex's and then flash ur modified apk.
Daneshm90 said:
Refer to my signature. Apk manager.
Edit : just read ur op.
Never sign the system apk's. Simply keep the original signatures intact and after recompiling them, re-include them.
Click to expand...
Click to collapse
Hi, I am already using apk manager but the xml files it creates do not seem to work.
To prove this, I have done a test. See the attached xml files,
original_stat_sys_battery.xml was extracted from the original framework-res.apk
I then used apk manager to decompile and then recompile the same apk without making any changes.
recompiled_stat_sys_battery.xml is this recompiled file
I then opened up both files and they look different to me
vibez said:
Hi, I am already using apk manager but the xml files it creates do not seem to work.
To prove this, I have done a test. See the attached xml files,
original_stat_sys_battery.xml was extracted from the original framework-res.apk
I then used apk manager to decompile and then recompile the same apk without making any changes.
recompiled_stat_sys_battery.xml is this recompiled file
I then opened up both files and they look different to me
Click to expand...
Click to collapse
That shouldn't concern u. Apktool's method of rebuilding the apk/arsc file is slightly different than how android originally builds an apk. What should concern u is if the apk simply works. Now when u decompile the apk, can u check the log to see if it reports of any missing resources, if it doesn't ur fine. So decompile the apk, make ur changes, recompile the apk, move the original meta-inf folder into ur new apk and push it to ur phone following the guidelines in my previous post. if it causes problems, post ur log and i'll take a look.
Ok this time I have added meta-inf to the new apk, pushed it to my phone and the phone hangs on boot.
Here is my log
--------------------------------------------------------------------------
|08/08/2010 -- 18:36:30.87|
--------------------------------------------------------------------------
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the path specified.
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
'adb' is not recognized as an internal or external command,
operable program or batch file.
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged.apk
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged-signed.apk
Could Not Find C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\place-apk-here-for-modding\../place-apk-here-for-modding/repackaged-unsigned.apk
The system cannot find the file specified.
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'keyguard_password_attempts_count_pin_code' has no default translation in C:\Documents and Settings\Lee\Desktop\Apk_Manager_4.8\other\..\out\res; found: fr ko
I: Building apk file...
Click to expand...
Click to collapse
Oh lol i meant the log of ur phone.
Use adb logcat
lol ok, at which point should I run logcat - after the hang or as soon as I switch the phone on?
vibez said:
lol ok, at which point should I run logcat - after the hang or as soon as I switch the phone on?
Click to expand...
Click to collapse
When u switch phone On.
Ok here you are
vibez said:
Ok here you are
Click to expand...
Click to collapse
Heres ur culprit
Code:
java.lang.SecurityException: META-INF/MANIFEST.MF has invalid digest for AndroidManifest.xml
Now seems u modified the androidmanifest.xml ? If u didn't then heres my recommendation, copy over the original androidmanifest.xml from the original apk.

[Q] HELP - how to edit (modify) themes (mixing images)

Hello,
little background. i know my way around ROM installation (changing Kernels,modems, installing themes etc.) and read about how to use apk manager.
one of the things i still can't figure out, and seems to me like the next step is modifiyng themes.
i am currently using Perception 10.2, with stock theme. i really like the paragon basic theme + few more icons and items from phoneix and other themes.
i wend ahead and decompiled framework-res.apk from all the themes, and tried to copy over the images from the paragon drawable-hdpi folder to the same folder in Perception.
importent note, i know that there might be an issue with editing a .9.png file, but i assumed copying over a file that works in another rom is acceptable.
hope some of you are still with me.. here is the catch... tried to Compile the apk... and errors...
here is a parital log:
--------
|Sat 01/22/2011 -- 17:23:37.28|
--------------------------------------------------------------------------
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
'adb' is not recognized as an internal or external command,
operable program or batch file.
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_disabled.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_disabled_focused.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_normal.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_pressed.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_selected.9.png
libpng error: Read Error
Click to expand...
Click to collapse
different error:
Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\public.xml:3756: error: Public symbol drawable/zzzzz_tw_quickcontact_slider_grip_left declared here is not defined.
Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\public.xml:3757: error: Public symbol drawable/zzzzz_tw_quickcontact_slider_grip_right declared here is not defined.
Click to expand...
Click to collapse
i hope someone can make sense out of this... i thought it would be a simple proccess, hope i did something wrong and it will be an easy fix...
Thank you so much for reading this far, your help will be appreciated!
Yossi
The problem you're having is with semi-transparent .9 files. The Android SDK png handler can't decompile them, so when you look at them in explorer they'll have a default image meaning they're corrupt.
The easiest way to deal with them is to not decompile and recompile.
PNG Only: With apk manager, take the original framework files from the ROM (or phone if stock) and drop them into place-apk-here-for-modding, then take the themed frameworks, rename them (something like framework-resParagon.apk) and drop those into place-apk-here-for-modding.
Select each one and extract (not decompile).
Open the drawable-hdpi folders side-by-side of the original and the theme, and drag (Copy) the ones you want to the original.
Then Zip the original and select System APK, and you're done. The reason this work is because the .9 files are still in their compiled state.
If you need to copy xml files, do this first, then the first step for png files: Decompile the two, copy the XML files, and recompile. Compiled XML files convert the png names to IDs which may be different between two roms. If you already have .9.png files that don't decompile, here's the fun part and I guess I'm doing all of this out of order, sorry...
Have an orginal apk decompiled with a different name, extract your modded apk, drag the drawable-hdpi out to say desktop, delete that project, decompile, drag the original decompiled drawable-hdpi into your modded one, and now you can edit/copy XML files and recompile. Then delete the project, extract, delete drawable-hdpi and drag the desktop drawable-hdpi to the project and zip it up. Done.
Or quick version.. 7zip helps.
right click the apk you want the images from, extract it.
right click open archive the apk you want the images in.
navage down to the folder that the images are stored in while in 7zip.
go back to the extracted folder and navagate down to the folder the images you want are in.
drag and drop them into the open archive 7zip window.
close archive
push
whiteguypl said:
Or quick version.. 7zip helps.
right click the apk you want the images from, extract it.
right click open archive the apk you want the images in.
navage down to the folder that the images are stored in while in 7zip.
go back to the extracted folder and navagate down to the folder the images you want are in.
drag and drop them into the open archive 7zip window.
close archive
push
Click to expand...
Click to collapse
CuriousTech said:
The problem you're having is with semi-transparent .9 files. The Android SDK png handler can't decompile them, so when you look at them in explorer they'll have a default image meaning they're corrupt.
The easiest way to deal with them is to not decompile and recompile.
PNG Only: With apk manager, take the original framework files from the ROM (or phone if stock) and drop them into place-apk-here-for-modding, then take the themed frameworks, rename them (something like framework-resParagon.apk) and drop those into place-apk-here-for-modding.
Select each one and extract (not decompile).
Open the drawable-hdpi folders side-by-side of the original and the theme, and drag (Copy) the ones you want to the original.
Then Zip the original and select System APK, and you're done. The reason this work is because the .9 files are still in their compiled state.
If you need to copy xml files, do this first, then the first step for png files: Decompile the two, copy the XML files, and recompile. Compiled XML files convert the png names to IDs which may be different between two roms. If you already have .9.png files that don't decompile, here's the fun part and I guess I'm doing all of this out of order, sorry...
Have an orginal apk decompiled with a different name, extract your modded apk, drag the drawable-hdpi out to say desktop, delete that project, decompile, drag the original decompiled drawable-hdpi into your modded one, and now you can edit/copy XML files and recompile. Then delete the project, extract, delete drawable-hdpi and drag the desktop drawable-hdpi to the project and zip it up. Done.
Click to expand...
Click to collapse
Thanks guys! i knew there should be a simple solution!
will try this soon. and post results!
Yossi
Also make sure to double check the sizes, the height and width my be different and give you issues if you copy and past the pngs
Sent from my SGH-I897 using XDA App
Also with 2.2.1 there's a problem with compressed apk files, so in apk manager, you need to set compression to 0. It's not a problem when dropping them into an apk with 7zip.
Different sized png files are usually the expanded notification bar switches. The darkness theme for example uses smaller ones. The size change is in twframework-res.apk/res/layout/status_bar_expanded.xml so those should be copied together (decompiled).
Another way to customize just 1 or a few .xml or .9.png files is to decompile the original, edit the xml or .9.png (with your modified one in mind), then compile. Then rip the compiled files from it and drop them into the themed one, assuming you already used the original the first time.
CuriousTech said:
Also with 2.2.1 there's a problem with compressed apk files, so in apk manager, you need to set compression to 0. It's not a problem when dropping them into an apk with 7zip.
Different sized png files are usually the expanded notification bar switches. The darkness theme for example uses smaller ones. The size change is in twframework-res.apk/res/layout/status_bar_expanded.xml so those should be copied together (decompiled).
Another way to customize just 1 or a few .xml or .9.png files is to decompile the original, edit the xml or .9.png (with your modified one in mind), then compile. Then rip the compiled files from it and drop them into the themed one, assuming you already used the original the first time.
Click to expand...
Click to collapse
so, double - checking that i understood...
method1: replacing images (same size) using copmpiled source and destination.
if i want to copy iver png's from one theme to another, i only decompress (or 7ZIP - open) the apk's - Replace the pics, and compress bacl (with compression set to 0).
method 2 : replacing images of different sizes
if the images are of different sizes, i should decompile both apk's, than i should copy the corrosponding XML from the new image's source, and drop in the original drawable directory, compile the apk, than copy over the image using method 1.
am i correct?
Thank you all for your help!!!
Yossi
In method 1, don't decompress it when using 7zip (or any other), just open the apk, drop the files in where they go, leaving the apk (zip) intact. If you extract the full apk, modify the files, and compress it back to a new apk it will lose the signature. That's what apk manager does when you zip it and select "system APK". It copies the signature from the original to the new one. Think of it like a zip comment. It's not a file, but a chunk of data attached to the zip that can't be copied from one zip to another.
Method 2: Too complicated. Just use method 1 to do as much as you can.
Whoever put the theme together originally did it incorrectly/lazily.
If you want to spend the time fixing it, then you need to decompile the same version of the .apk (the Samsung stock version, for example) and copypasta the themed one on top of it, while keeping the 1 pixel border.
One more question...or maybe two
when i decompile a framework-res.apk, i only get one drawable-hdpi folder.
if i open the apk using 7zip...i have a 2 folders: one is the same... and and another one that have this name: drawable-hdpi-v4
i replaced all the items i wanted in the drawable-hdpi folder..uploaded to the phone...and nothing happend... than i tried copying over some items to the drawable-hdpi-v4 foder..than i saw the changes.... the question is... do i have to copy the files to both follders? or just the drawable-hdpi-v4 folder?
another question tha poped into my mind right now, is it common that after i replace the framework-res.apk, my accounts data gets erased? (gmail account, facebook, etc)?
Thanks!
Yossi
Get the apktool in this thread and rename your old one just in case:
http://forum.xda-developers.com/showthread.php?t=864424&page=5
Oh, read the thread too. Good info!
The -v4 folders are higher resolution, or supposed to be. They take priority over the others, so if the image is only in drawable-hdpi it will be used, if it's in both the -v4 is used, or if it's only in -v4 it's used. I just leave the non-v4 alone, but it might save space to empty it, just scared to try.
You shouldn't lose account data though. That might indicate a problem. Not sure?
MikeyMike01 said:
Whoever put the theme together originally did it incorrectly/lazily.
Click to expand...
Click to collapse
I don't think the theme makers are to blame. Try decompiling a stock apk, then set the opacity of any .9.png to anything but 100%, draw9patch it again, then compile, then decompile and try to view that png. It's going to be damaged.
Well, it's actually easier to photoshop a compiled one, then remove the .9 and drop in draw9patch but you know what I mean.
I just don't think apktool can handle the extra info in a png.

[Guide][Miui V5] How to Edit framework-miui-res.apk and Related Applications

Hi, it seems some dear users have problems with Miui V5 framework and miui's applications decompiling proccess.
let's begin!
for this job, Im editing the APK Multitool, and all credits will goes to his developer. [raziel23x]
original thread
what's new on this?
changed the aapt to miui compatible, added miui frameworks to default list, added additional frameworks, also you can pull back the files from the phone via adb command.
i wrote it before, original thread
-------------------------------------------------------------------------------------------------------------------------------------------------------------
for version 11.0.1.2 and older!
Download the Attached file.
extract it.
copy these files
Code:
framework-res.apk
framework-miui-res.apk
twframework-res.apk
MiuiSystemUI.apk
from Miui Rom into other folder.
run, Setup.bat script.
Select option 2:
Code:
*
* 2. Installing Framework-Res
* This Will install one of the Framwork-Res Files for 1.x/2.x/3.x/4.x
* This Feature also will install any of the other Dependencies needed
* In order to use this feature make sure to drop all of the needed files
* into the other Folder or else this script will not find them *
*
in next window, install these frameworks by entering related numbers. install it as this order and sequence
Code:
Install framework-res.apk
Install twframework-res.apk
Install Additional Frameworks
Install framework-miui-res.apk
Install MiuiSystemUI.apk
after installing, enter the "9" to get back to main screen.
run setup by entering "3".
Code:
3. Setup Directories
This will setup the appropate directories needed by Apk Multi-Tools
(This script only needs to be ran for first time users do not use if your
Just updating from previous Version
now new folders will create on main folder of this apk multi tool.
Framework's Description
- 1 = framework-res.apk
- 2 = twframework-res.apk
- 3 = additional frameworks
- 4 = additional frameworks
- 5 = additional frameworks
- 6 = framework-miui-res.apk
- 127 = SystemUI.apk​
Version 1.11.0.3 XIAOMI Phones.
1- Download Version 1.0.11.3 [[XIAOMI]MIUI_V5_APKMULTITOOL_1.0.11.3.zip] and extract it.
2- Copy MiuiSystemUI.apk, framework-res.apk and framework-miui-res.apk from your rom or phone into other folder.
3- Run Setup.bat file, choose option 2 and then select option 1 for automatically installing all frameworks.
or you can install frameworks manually
Code:
2. Install framework-res.apk
3. Install dummy frameworks
4. Install framework-miui-res.apk
4- from main menu, run option 3
Code:
3. Setup Directories
This will setup the appropate directories needed by Apk Multi-Tools
(This script only needs to be ran for first time users do not use if your
Just updating from previous Version)
best regards.
How to Edit framework-miui-res.apk?
copy framework-miui-res.apk into "place-apk-here-for-modding" folder, run "Script.bat" file.
choose your project , by entering the " 24 Set current project" [24].
the select your project with related number.
decompile apk.
Code:
9 Decompile apk
when the framework-miui-res.apk get decompiled, goto project folder and on the framework-miui-res.apk , open the "apktool.yml" file via notepadd++.
you will see like this one:
Code:
version: 1.5.2
apkFileName: framework-miui-res.apk
isFrameworkApk: true
usesFramework:
ids:
- 1
sdkInfo:
minSdkVersion: '16'
targetSdkVersion: '16'
packageInfo:
cur_package: miui
orig_package: miui
compressionType: true
add additional frameworks , just like below one
Code:
version: 1.5.2
apkFileName: framework-miui-res.apk
isFrameworkApk: true
usesFramework:
ids:
- 1
- 2
- 3
- 4
- 5
sdkInfo:
minSdkVersion: '16'
targetSdkVersion: '16'
packageInfo:
cur_package: miui
orig_package: miui
compressionType: true
save the file.
now go and edit this file, at final you can compile it.
for compile you can use "11 Compile System APK files" option.​
if you have any problem, please upload the "APK-Multi-Tool.log" file and tell your problem.
Changelog:
version 1.0.11.1 initial release
version 1.0.11.2 , fixed framework installing.
Version 1.0.11.3 , specially for XIAOMI phones and updated apktool to version 1.5.3 snapshot.
+ fixed and removed some scripts
+ all in one framework installer [ option 1]
+ added miui JB frameworks [ ID 2 ~ ID5]
​
M_J_Nazari said:
if you have any problem, please upload the "APK-Multi-Tool.log" file and tell your problem.
Click to expand...
Click to collapse
Thank you Nazari!
I dont know if this script is only meant to work with SGS III files...
I followed your instructions using MI-2 files (without twframework-res.apk of course).
And after de-compiling the apk I can't compile it back.
I'm getting:
error occurred, please check the log (option 21)
Click to expand...
Click to collapse
Btw I notice that inside the apktool.yml
I got
compressiontype: false
Click to expand...
Click to collapse
This is my log:
--------------------------------------------------------------------------
|Sun 06/02/2013 -- 17:55:49.16|
--------------------------------------------------------------------------
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Sagi\apktool\framework\1.apk
I: Loaded.
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.err.CantFindFrameworkResException
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:358)
at brut.androlib.Androlib.buildResources(Androlib.java:283)
at brut.androlib.Androlib.build(Androlib.java:206)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
Caused by: brut.androlib.err.CantFindFrameworkResException
at brut.androlib.res.AndrolibResources.getFrameworkApk(AndrolibResources.java:544)
at brut.androlib.Androlib.parseUsesFramework(Androlib.java:508)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:336)
... 5 more
Click to expand...
Click to collapse
I'm guessing it is because of the 'twframework-res.apk' which i dont have...(MI-2 not Samsung).
SagiMedina said:
Thank you Nazari!
I dont know if this script is only meant to work with SGS III files...
I followed your instructions using MI-2 files (without twframework-res.apk of course).
And after de-compiling the apk I can't compile it back.
I'm getting:
Btw I notice that inside the apktool.yml
I got
This is my log:
I'm guessing it is because of the 'twframework-res.apk' which i dont have...(MI-2 not Samsung).
Click to expand...
Click to collapse
W: Could not find sources
so, don't change the "apktool.yml" file and then compile it. see the result. maybe your phone doesn't boot!!
oh,,, i forget to add framework 5 to package, download it and copy to "C:\Users\Sagi\apktool\framework\" folder. i will update the package as soon.
or you can use new package, i added new description and new fixed version.
M_J_Nazari said:
W: Could not find sources
so, don't change the "apktool.yml" file and then compile it. see the result. maybe your phone doesn't boot!!
oh,,, i forget to add framework 5 to package, download it and copy to "C:\Users\Sagi\apktool\framework\" folder. i will update the package as soon.
or you can use new package, i added new description and new fixed version.
Click to expand...
Click to collapse
After I used the new package I succeed to compile it back but the phone doesn't boot.
In apktool.yml I add only
-1
-3
-4
-5
-2 and -6 gave me errors.
I noticed that the new apk size is smaller then the original.
Sent from my MI 2
SagiMedina said:
After I used the new package I succeed to compile it back but the phone doesn't boot.
In apktool.yml I add only
-1
-3
-4
-5
-2 and -6 gave me errors.
I noticed that the new apk size is smaller then the original.
Sent from my MI 2
Click to expand...
Click to collapse
do a search into framework folder, if there is another apk file, i think you need to install this framework. i don't know about the xiaomi phones like mi2 or another.
and, are you sure that you did all steps perfectly?
could you please tell us what did you exactly for compiling process? i mean after entering option "11".
M_J_Nazari said:
and, are you sure that you did all steps perfectly?
could you please tell us what did you exactly for compiling process? i mean after entering option "11".
Click to expand...
Click to collapse
I followed the steps as you wrote except with the twframework, then I edit the apktool.yml
But instead of adding:
-1 to -6
I only add
-1, -3,-4,-5
I edit the style following your guide,
Then I compiled back by entering option 11, copied the 'unsignedframework-miui-res.apk' to my phone and renamed it to 'framework-miui-res.apk' and past it in system/framework. The phone rebooted but got stuck after the bootanimation.
Sent from my MI 2
SagiMedina said:
I followed the steps as you wrote except with the twframework, then I edit the apktool.yml
But instead of adding:
-1 to -6
I only add
-1, -3,-4,-5
I edit the style following your guide,
Then I compiled back by entering option 11, copied the 'unsignedframework-miui-res.apk' to my phone and renamed it to 'framework-miui-res.apk' and past it in system/framework. The phone rebooted but got stuck after the bootanimation.
Sent from my MI 2
Click to expand...
Click to collapse
what's about the keep folder?
M_J_Nazari said:
what's about the keep folder?
Click to expand...
Click to collapse
What is the keep folder?
Sent from my MI 2
SagiMedina said:
What is the keep folder?
Sent from my MI 2
Click to expand...
Click to collapse
ok, i think it is need to know how to work with apk multi tool.
1- decompie
2- edit your framework
3- enter option 11 to compile
4- programs will ask you about the modification , just like this:
Code:
Building Apk
Aside from the signatures, would you like to copy
over any additional files that you didn't modify
from the original apk in order to ensure least
# of errors (y/n)
Type input:
5- enter " y ' and then press enter.
6- wait for programs, to show you this message
Code:
Everything is Ok
Files: x
Size: xxxxx
Compressed: xxxxx
In the APK Multi-Tools folder u'll find
a keep folder. Within it, delete
everything you have modified and leave
files that you haven't. IF you have modified
any xml, then delete resources.arsc from that
folder as well. Once done then press enter
on this script.
Press any key to continue . . .
7- don't touch anything, minimize Apk Multitool program window ,
8-Go back to the main folder of apk multi tool , you will find the "keep" folder.
goto keep folder and delete thisfile "resources.arsc"
9- get back to Apk Multitool program and hit any key to create a new framework-miui-res.apk file with this name
"unsignedframework-miui-res.apk" file.
10- rename it and copy to your phone, do a permission
you can do it via root Explorer
or terminal command
Code:
chmod 0644 /system/framework/framewok-miui-res.apk
or adb commnad
Code:
adb shell chmod 0644 /system/framework/framewok-miui-res.apk
M_J_Nazari said:
...
Click to expand...
Click to collapse
Still no luck Nazari, did everything like you said...
I cant get pass the boot animation once i replace the framework,
why is the new apk is smaller? is it normal?
SagiMedina said:
Still no luck Nazari, did everything like you said...
I cant get pass the boot animation once i replace the framework,
why is the new apk is smaller? is it normal?
Click to expand...
Click to collapse
its normal, you can select compression level by hitting option "21".
but upload your framework-miui-res.apk here to check it and i will make changes to that.
M_J_Nazari said:
its normal, you can select compression level by hitting option "21".
but upload your framework-miui-res.apk here to check it and i will make changes to that.
Click to expand...
Click to collapse
Thanks Nazari!!!
SagiMedina said:
Thanks Nazari!!!
Click to expand...
Click to collapse
it seems xiaomi uses different framework and aapt version, you need to ask them.
M_J_Nazari said:
it seems xiaomi uses different framework and aapt version, you need to ask them.
Click to expand...
Click to collapse
If ill get these different framework and aapt version, I only need to replace them with the those in the 'other' folder?
Guys, you don't have a clue what that other frameworks are for, do you? You can't miss nr 1 or 6 or 2 framework in apktool.yml because that will never work! Apktool.yml is fine and should look like in the first post.
I think your main issue is that you don't know frameworks IDs?
This:
Code:
1. Install framework-miui-res.apk
2. Install framework-res.apk
3. Install twframework-res.apk
6. Install MiuiSystemUI.apk
7. Install Additional Frameworks
Is wrong!
How to tell what ID framework has?
Run this command:
Code:
apktool if framework-miui-res.apk
You will get:
Code:
I: Framework installed to: /home/acid/apktool/framework/6.apk
So framework-miui-res.apk is ID = 6.
Try to install regular framework-res.apk. You will get ID = 1.
To complete the gap between ID1 and ID6 you have to install proper frameworks. AND MiuiSystemUi is NOT a framework! Thats nonsense!
ID is 127 which is out of range.
You have to install framework files that have proper ID from 1 to 6.
ID1:
framework-res.apk
ID2:
frameworks from producer base. So this is twframework-res for Samsung devices, com.htc.resources.apk for HTC, SemcGenericUxpRes.apk for Sony... etc. That doesnt really matter. ID2 frameworks are used when you recompile stock apps like Samsung TW apps or HTC apps (HTCAlbum, Music etc). If you just want to recompile framework-miui-res and boot rom then you can use any ID2 framework or just a dummy file.
ID3:
This is com.htc.dummyskin.apk. Just search for it. You can find it in HTC One roms (One X and One S). Search in MIUI roms for that devices (but with stock HTC based MIUI!). Or grab the file from micode.
ID4:
This is framework-htc-res.apk. Again. search for it. Also HTC roms should have this or grab dummy framework from micode.
ID5:
From micode.
ID6:
framework-miui-res.apk
Dummy frameworks from MiCode:
https://github.com/MiCode/patchrom_build/tree/jellybean/res
You can use 3-5.apk to fill the gap. But still I advice you to use proper ID2 frameworks in case you would like to compile stock apps.
And for last install frameworks in order:
Code:
apktool if framework-res.apk
apktool if twframework-res.apk (or htc or dummy)
apktool if 3.apk
apktool if 4.apk
apktool if 5.apk
apktool if framework-miui-res.apk
That should allow you to boot the rom. Also make sure you have miui aapt and apktool 1.5.3.
thanks a lot @ Accidd for very good explanation.
i worte it for samsung devices, and it seems its fine. this script will install frameworks automatically.
but for other devices i will update the application again, so if we want to compile Xiaomi frameworks , we need to use dummy framework for ID number 2?
It doesn't matter which device you do. You always have to install all frameworks.
Wysłane z MI-2
M_J_Nazari said:
i will update the application again,
Click to expand...
Click to collapse
Thanks Nazari!
And thank you Acid for clearing things!
Sent from my MI 2
Version 1.0.11.3 added to first post to compile Xiaomi phones frameworks.

[MOD] Multi DPI Camera and Samsung Keyboard

Decided to start a new thread as this one was getting a bit messy (and I couldn't change the title anymore)
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-multi-dpi-samsung-apps-camera-t3141148
----------------------------------------------------------
Hi all, after changing the dpi to 480 the camera was the main thing bugging me. Looking for a solution I found this thread:
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-fix-samsung-camera-app-device-dpi-t3131995
But that did not work for me, so I decided to try it myself and I finally managed to create multi-dpi versions of the Camera and Samsung Keyboard apps. They are based on the apks from the XtreStoLite Universal Deo-Mod Edition 1.5 as I'm currently running that. So just give it a try (backup the original apks first! I usually just rename them to "filename.org") and let me know if it works for you. I tested on 480 and 520 dpi and that works here...
Installation:
1. Backup original apk (in system\app\SamsungCamera4 and/or systemm\app\SamsungIMEv2 )
2. Extract modded apk to the corresponding folder
3. Wipe data for the app
4. Reboot
I basically modified the dimens.xml file to hardcoded pixel sizes instead of dip value, modifying dip value caused other issues for me (camcorder not working, pro mode messing up). Hopefully it's of use to some.
I have not been able to fix the Contacts/Dialer (SecContacts_L.apk in the priv-app folder)! I either get a corrupt apk (parsing error) or it just won't show up in my apps. Corrupted apk gives a parsing error when trying to install manually, otherwise it just says 'install failed'.
I am guessing this is somethiong with the priv-app folder and other restrictions there. I also tried copying the apk to the system\app folder instead but that didn't work either...
If anyone has ANY idea how to fix this? (I tried with both apktool as apk multitool).
*SCRIPTS ADDED*
Added the scripts and all I've written for this to this post for those wanting to try themselves (dpi_mod.zip). They are not completely polished so need some manual editing every now and then...
Basically, doubleclicking apk_process.bat in the root will go through the apk's in the apk subfolder and
1. Decompile them to the decompiled subfolder
2. Edit the dimens.xml file in the res\values subfolder of the decompiled folder replacing all the <n>dip values with <4*n>px (So 640 dip becomes 2560px for example...)
3. Rebuild the apk to the dpimod_apk subfolder (using the -c option to keep original manifest and signature files)
The files folder contains the files used (apktool, the subscripts for each step, signature files, (g)awk and an awk script to process the xml file replacing the values, etc)
There is also a script for signing the apk manually, but somehow the apk then also doesn;t work in my case it seems...
ALl scripts are windows batch files (and an awk file) as I mainly use windows at home. Shouldn't be too hard for the linux users to convert them to bash files if desired...
*EDIT2*
Added patched services.jar (and original services.jar for restoration in case of issues). Flash through twrp recovery... This allows you to use the modded SecContacts_L.apk supplied, the services.jar needs to be patched to disable the signature verification for the (system) apk files. Note that this might cause issues (an invalid services.jar caused my phone to get stuck in boot... had to restore the original to be able to continue) so use at your own risk!
Great job !
I have not been able to decompile the contacts.apk either.. I am a bit rusty tho.. will have to look into that a little more.
fOmey said:
Great job !
I have not been able to decompile the contacts.apk either.. I am a bit rusty tho.. will have to look into that a little more.
Click to expand...
Click to collapse
Thanks! And yeah, weird stuff.
I actually was only really bothered by the camera, not using the samsung keyboard at all myself and don't mind the contacts as much (perfectly usable for me) but it's now a matter of principle If you find anything out, I would love to hear.
dagrim1 said:
Thanks! And yeah, weird stuff.
I actually was only really bothered by the camera, not using the samsung keyboard at all myself and don't mind the contacts as much (perfectly usable for me) but it's now a matter of principle If you find anything out, I would love to hear.
Click to expand...
Click to collapse
But In Call screen looks weird with 480 DPI right? Would you know any fix for that? Thanks.
Sent from my SM-G925F using XDA Free mobile app
ksekhar said:
But In Call screen looks weird with 480 DPI right? Would you know any fix for that? Thanks.
Sent from my SM-G925F using XDA Free mobile app
Click to expand...
Click to collapse
Yup, it does. (But again, doesn't bother me as much as I don't look at it long because I usually hold my phone to my ear anyway ).
But yeah, I think I know where to fix it... It's the Contacts apk I mentioned above but there is an issue with decompiling/rebuilding it so can't fix it yet. Looking into it.
Did notice when decompiling and recompiling including resources it fails, when keeping resources intact it does work.
To successfully mod seccontacts you have to do these steps :
- Decompile apk
- Edit xml files in res folder
- Recompile apk
- Extract xml edited files in res folder from recompiled apk
- Paste these xml files in the original apk in the res folder with compression tool like Winrar
It works I made this with my S5.
Meh, been looking into it some more and also found this:
http://forum.xda-developers.com/android/software-hacking/how-to-recompile-tw-contacts-phone-t3066350
and
http://www.ez-pg.com/guide-how-to-decompilerecompile-lollipop-seccontacts.html
I tried modifying the manifest as instructed, but the apk still didn't work. Perhaps because signature verfication is not properly disabled on my rom. BUt if it isn't it is also not for the majority of the users in which case siumply supplying the apk wouldn't work anyway.
I also tried resigning the apk, no luck. Copying the original manifast is also not going to work afaik with a changed manifest file...
More info about signature verficiation:
http://forum.xda-developers.com/showthread.php?t=2725233
http://forum.xda-developers.com/showthread.php?t=2342262
Perhaps I will try this soon as well, but for now I think I'll leave it be...
sebdigital said:
To successfully mod seccontacts you have to do these steps :
- Decompile apk
- Edit xml files in res folder
- Recompile apk
- Extract xml edited files in res folder from recompiled apk
- Paste these xml files in the original apk in the res folder with compression tool like Winrar
It works I made this with my S5.
Click to expand...
Click to collapse
Thanks for the tip, had looked into that as well but this xml file is in the values folder which is not simply found in the res folder of the apk but compiled into the resources.arsc file in the apk so this is not working unfortunately.
dagrim1 said:
Thanks for the tip, had looked into that as well but this xml file is in the values folder which is not simply found in the res folder of the apk but compiled into the resources.arsc file in the apk so this is not working unfortunately.
Click to expand...
Click to collapse
I'm on 5.1.1 today and noticed that contacts/dialer is (almost) multi DPI already without having to do anything. And your camera mod works on 5.1.1 too!
Sent from my SM-G920F using XDA Free mobile app
can u change this Camera 480 dpi camera s6 to 420 dpi?
https://mega.nz/#!M4Ui0KoR!TKsPKkMl-XQHyiJ_DNf53eQCGZTrYWhuHaAnhAYXeSM
thanks you very much
can be used for other than s6 for SamsungCamera4. ??
my android device A8 6
dagrim1 said:
Decided to start a new thread as this one was getting a bit messy (and I couldn't change the title anymore)
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-multi-dpi-samsung-apps-camera-t3141148
----------------------------------------------------------
Hi all, after changing the dpi to 480 the camera was the main thing bugging me. Looking for a solution I found this thread:
http://forum.xda-developers.com/galaxy-s6/themes-apps/mod-fix-samsung-camera-app-device-dpi-t3131995
But that did not work for me, so I decided to try it myself and I finally managed to create multi-dpi versions of the Camera and Samsung Keyboard apps. They are based on the apks from the XtreStoLite Universal Deo-Mod Edition 1.5 as I'm currently running that. So just give it a try (backup the original apks first! I usually just rename them to "filename.org") and let me know if it works for you. I tested on 480 and 520 dpi and that works here...
Installation:
1. Backup original apk (in system\app\SamsungCamera4 and/or systemm\app\SamsungIMEv2 )
2. Extract modded apk to the corresponding folder
3. Wipe data for the app
4. Reboot
I basically modified the dimens.xml file to hardcoded pixel sizes instead of dip value, modifying dip value caused other issues for me (camcorder not working, pro mode messing up). Hopefully it's of use to some.
I have not been able to fix the Contacts/Dialer (SecContacts_L.apk in the priv-app folder)! I either get a corrupt apk (parsing error) or it just won't show up in my apps. Corrupted apk gives a parsing error when trying to install manually, otherwise it just says 'install failed'.
I am guessing this is somethiong with the priv-app folder and other restrictions there. I also tried copying the apk to the system\app folder instead but that didn't work either...
If anyone has ANY idea how to fix this? (I tried with both apktool as apk multitool).
*SCRIPTS ADDED*
Added the scripts and all I've written for this to this post for those wanting to try themselves (dpi_mod.zip). They are not completely polished so need some manual editing every now and then...
Basically, doubleclicking apk_process.bat in the root will go through the apk's in the apk subfolder and
1. Decompile them to the decompiled subfolder
2. Edit the dimens.xml file in the res\values subfolder of the decompiled folder replacing all the <n>dip values with <4*n>px (So 640 dip becomes 2560px for example...)
3. Rebuild the apk to the dpimod_apk subfolder (using the -c option to keep original manifest and signature files)
The files folder contains the files used (apktool, the subscripts for each step, signature files, (g)awk and an awk script to process the xml file replacing the values, etc)
There is also a script for signing the apk manually, but somehow the apk then also doesn;t work in my case it seems...
ALl scripts are windows batch files (and an awk file) as I mainly use windows at home. Shouldn't be too hard for the linux users to convert them to bash files if desired...
*EDIT2*
Added patched services.jar (and original services.jar for restoration in case of issues). Flash through twrp recovery... This allows you to use the modded SecContacts_L.apk supplied, the services.jar needs to be patched to disable the signature verification for the (system) apk files. Note that this might cause issues (an invalid services.jar caused my phone to get stuck in boot... had to restore the original to be able to continue) so use at your own risk!
Click to expand...
Click to collapse
how to fix on parse error, after recompile SamsungCamera4.apk with apktool
with or without edit error on parse...
My device Galaxy-A8

the package appears to be corrupt after Recompile

I Decompile apk app and recompile it without any edit but the app is didn't install the error message : the package appears to be corrupt after Recompile
I tried
apktool + dex-tools + signapk
apk easy tool
apk editor studio
what is a problem?
i want edit mediabox launcher
how can i do it?
please help me.
this error
Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Package couldn't be installed in /data/app/com.droidlogic.mboxlauncher-1: Package com.droidlogic.mboxlauncher has no signatures that match those in shared user android.uid.system; ignoring!]
Any luck in similar situations? Anybody?
Abo Battal said:
I Decompile apk app and recompile it without any edit but the app is didn't install the error message : the package appears to be corrupt after Recompile
I tried
apktool + dex-tools + signapk
apk easy tool
apk editor studio
what is a problem?
Click to expand...
Click to collapse
The error message "the package appears to be corrupt" usually indicates that there is an issue with the APK file itself, such as missing or corrupted files, incorrect file permissions, or a problem with the signing process.
It's possible that the decompilation process may have introduced some errors or corrupted files in the APK, even if you did not make any edits to the code. When you recompiled the APK, these errors may have been carried over, resulting in the "corrupt" package.
To troubleshoot this issue, you could try the following steps:
Make sure you are using the latest version of the APK tools (apktool, dex-tools, signapk, etc.), as older versions may have bugs or limitations that could cause issues.
Check the log files generated during the decompilation and recompilation process to see if there were any errors or warnings that may have contributed to the issue.
Try recompiling the APK using a different tool or method, to see if that resolves the issue.
If none of the above steps work, you may need to examine the APK file more closely to determine the root cause of the problem. This could involve examining the file structure, checking file permissions and signatures, or even using a more advanced debugging tool such as Android Studio.

Categories

Resources