yashsingh1/xdaforums huggingface dataset:
[Android Software Development] CosmicDan:
That's something new then, drawables don't go in layout directories. Unless they've done it on purpose, and APKTool skips decompiling it. Find tapjoy_buttonselected(.9)(.png) - wherever that may be - and copy it to another drawable-xxx folder. If you can't find it at all in APKTool decompiled, try manually unzipping it to find it and copy it from there.

You are wanting to edit some other resources, right? If it was only smali you could just skip resource decoding.
[Android Software Development] Febby:
I really was just trying to do some minor edits to the manifest.XML file for a friend to make it so that app can rotate on his tablet rather than being stuck in portrait mode, he would prefer in landscape mode.

I had done it before but it really seems the devs went out of their way this time to protect it. Unless they did some bad coding this time around. Major headache when you aren't exactly code savy. :P
[Android Software Development] CosmicDan:
You should have told us that first :) Just skip decompiling smali and resources, then you can edit the Manifest.

Try doing this first:

apktool d -s -r Settings.apk

Note that when you recompile it, you'll have to resign it. If it's a non-system app, test-keys should work. Use Signapk for that.

Nevermind, that doesn't help. I am 99% sure you have wrong/old AAPT version somewhere in your path. layout-sw600dp is present in many APK files, and the unknwown error means it's using an old aapt binary.
[Android Software Development] Febby:
Hmmm strange... the AAPT.exe is what you are talking about right? The one I have is in platform tools and the apktools folder I made. I replaced both the aapt.exe with the aapt download link in the OP http://miui.connortumbleson.com/other/apktool/aapt/win/aapt.exe

Unless there is another location where AAPT is located that I'm possibly doing wrong. I shall double check. You guys give a new light to the xda experience by the way, thanks! :)
[Android Software Development] CosmicDan:
Just out of interest, I tried decompiling and recompiling it too. I'm using the latest modified AAPT and APKTool pre-1.5.1 someone built and posted a few pages back, and get totally different errors:

libpng error: Not a PNG file
ERROR: Failure processing PNG image E:\TEMP\com.papaya.papayafarm2012-1\res\drawable\ppy_more_game_shakebg.png
E:\TEMP\com.papaya.papayafarm2012-1\res\values\public.xml:4: error: Public symbol drawable/fire declared here is not defined.
E:\TEMP\com.papaya.papayafarm2012-1\res\values\public.xml:5: error: Public symbol drawable/icon declared here is not defined.
(Lots more undefined errors)

The APK is indeed protected. So I have no idea sorry.
[Android Software Development] Febby:
Thanks! I wanted to make sure It wasn't all stuck in my head. I will never understand their decision to protect it. I would probably understand protecting a paid apk. Thanks guys for the help with me this past hours of stress. :)
[Android Software Development] bgcngm:
Did anyone ever experienced this error?

Exception in thread "main" D:\MTK\MT6577\V970\app\Settings\res\values-el\strings.xml:2240: error: Error parsing XML: mismatched tag
brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-version, 15, -F, C:\Users\Bruno\AppData\Local\Temp\APKTOOL751952174820968540.tmp, -I, C:\Users\Bruno\apktool\framework\1.apk, -S, D:\MTK\MT6577\V970\app\Settings\res, -M, D:\MTK\MT6577\V970\app\Settings\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:337)
at brut.androlib.Androlib.buildResources(Androlib.java:284)
at brut.androlib.Androlib.build(Androlib.java:207)
at brut.androlib.Androlib.build(Androlib.java:180)
at brut.apktool.Main.cmdBuild(Main.java:209)
at brut.apktool.Main.main(Main.java:72)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-version, 15, -F, C:\Users\Bruno\AppData\Local\Temp\APKTOOL751952174820968540.tmp, -I, C:\Users\Bruno\apktool\framework\1.apk, -S, D:\MTK\MT6577\V970\app\Settings\res, -M, D:\MTK\MT6577\V970\app\Settings\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)
... 6 more

Line 2240 is the end of resources tag. I'm using apktool 1.5.1 PR1 and the latest aapt. Already tried to use -d (debug mode while recompiling) and -v (verbose output). Is there any simple way to find out what is causing tag mismatch?
[Android Software Development] varun.chitre15:
Just see if the xml starts with

<?xml version="1.0" encoding="utf-8"?>
<resources>

and ends with

</resources>

Also verify if any incomplete tags are not present anywhere within the xml.
[Android Software Development] bgcngm:
Thanks for replying, but that was the first thing I've checked and is okay. I guess I will have to do a deep search throughout the 2240 lines of this .xml to find the problem.
[Android Software Development] bgcngm:
Okay, just found the culprits. Several apostrophes were not being preceded by escape character. What is strange is that normally apktool provides more info about those errors, such as in the following case that I had already solved:

Exception in thread "main" D:\MTK\MT6577\V970\app\MtkBt\res\values-el\strings.xml:131: error: Apostrophe not preceded by \ (in ╬ê╬¥╬┐╬┤╬┐¤é ╬▒¤Ç' ¤ä╬┐╬¢ FTP client?)

Why not in the case of this other .xml file? Is it because it is too large? Could this be a bug?

EDIT: Well, after all the culprit was indeed an incomplete string tag within the .xml. In this case, apktool only throws the parsing XML error and further errors are not shown.
[Android Software Development] hello00:
how are people successfully recompiling 4.2 apks
[Android Software Development] iBotPeaches:
By fixing package name to match that of resources.arsc instead of manifest.
[Android Software Development] Darkman:
Could you explain more please? Thanks!
[Android Software Development] xxhorseriderxxx:
my issue is that resources.arsc is not being created,,, is there any way to fix that?

this is the apk that I was trying to decompile/recompile: (android 4.2 keyboard for nonAOSP devices)

http://www.mediafire.com/?b3pastx96extllr
[Android Software Development] hello00:
can someone please upload their apktool folder because im having trouble recompiling 4.2.1 apks
[Android Software Development] CosmicDan:
No. 4.2 APK's are not supported yet.
[Android Software Development] 1982Strand:
I got an issue on MIUI with the browser, i think it's caused by something in apktool. When i enter something in the adress bar to search for, i'm just redirected to an empty google page.

Think i recall this as something in the arrays.xml, when recompiling (and or decompiling?) it adds "amp" to every "&" entry in the strings...

Example:

In the English repo on github, for the Browser's array.xml (How it's supposed to look like):

<item>Yahoo! UK & Ireland</item>

When i decompile Browser.apk, same line becomes:

<item>Yahoo! UK &amp; Ireland</item>

Or is this only on my end? Is there anything i can do about it, besides manually editing the arrays.xml? Thanks :)
[Android Software Development] CosmicDan:
Yeah it's a known bug. We usually run a sed script to replace them with escaped unicodes until whenever APK Tool fixes it.

Here is an example - note that it's in a Windows script so if you're on Linux the sed syntax may be slightly different - but it should be easy to understand.

:handle_unicode
SET DO_UNICODE=0
FIND /C /I "&" %1 >nul
If %ERRORLEVEL% EQU 0 (
SET DO_UNICODE=1
)
FIND /C /I "<" %1 >nul
If %ERRORLEVEL% EQU 0 (
SET DO_UNICODE=1
)
If %DO_UNICODE% EQU 1 (
type %1 | sed -e "s/&lt;/\\u0026\\u003C/" -e "s/&.*lt;/\\u0026\\u003C/" -e "s/&.*amp;/\\u0026/" -e "s/&/\\u0026/" -e "s/</\\u003C/" > "%~1.new"
IF EXIST "%~1.new" (
DEL %1 && MOVE "%~1.new" %1
)
)
[Android Software Development] denseye:
I'm facing exactly the same problem.

Did you find any solution ?...
[Android Software Development] hello00:
i see some themers recompiling 4.2.1 with no problems tho
[Android Software Development] CosmicDan:
Well ask them then.
[Android Software Development] 1982Strand:
Ok, thanks :)

I'm using linux, already implemented something similar to this in my build script. Just wanted to be sure it wasn't just me f-ing things up :D

Anyways, thanks for the tip.
[Android Software Development] marhensa:
OK captain.

you are so helpful.

thanks.
[Android Software Development] bgcngm:
Did you installed framework-res?

apktool if framework-res.apk
[Android Software Development] Superman:
How to install?

Superman™
[Android Software Development] Deadly:
Type --> apktool if framework-res.apk

In command prompt/ terminal and hit enter button after typing to execute it:rolleyes:

That's what he said in his post..

____________________________________________

ಇದು ನನ್ನ ಆಪ್ ಸಿಗ್ನೇಚರ್

ΧΔΑ Fraternity: TOT Time! & IRC Info

If my post doesn't make sense, Ask HTC;)
[Android Software Development] Superman:
APK Manger right?
[Android Software Development] CosmicDan:
If you're using a GUI and don't know how to use a console, contact the GUI creator for how to do it. That's not what this thread is about.
[Android Software Development] Pneuma1985:
Hey ibot ? are we going to get an update for sense 4.5 lots of stuff doesnt seem to carry with it there are tons of work arounds just wondering if there was an update for apktool in the near future?
[Android Software Development] iBotPeaches:
I just got out of school 2 days ago and already started pushing to github and fixing compatibility. There will be an update. When it's ready.
[Android Software Development] Pneuma1985:
Thanks man just wondering always appreciate you work without your development there would be no development community honestly...You and brut.all
[Android Software Development] Casshern:
Keep up the great work! Definitely anticipating the update. :good:
[Android Software Development] raziel23x:
Actually Somali and basmati came first which this tool acts as a wrapper for with a few added features
[Android Software Development] cojo11:
LG 2x ICS 4.0.4

I try apktool 1.5.0 framework-res.apk is ok but i cant decompile SystemUI.apk and no other apk`s from ICS

anyone a tip??

C:\Dokumente und Einstellungen\jos>cd c:\apktool

C:\apktool>apktool d framework-res.apk
Destination directory (C:\apktool\framework-res) already exists. Use -f switch i
f you want to overwrite it.

C:\apktool>apktool d SystemUI.apk
Destination directory (C:\apktool\SystemUI) already exists. Use -f switch if you
want to overwrite it.

C:\apktool>apktool d SystemUI.apk
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Dokumente und Einstellungen\jos\apktool\
framework\1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01cb
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01c4
W: Could not decode attr value, using undecoded value instead: ns=android, name=
theme, value=0x020a01d6
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
Can't find framework resources for package of id: 2. You must install proper fra
mework files, see project website for more info.
[Android Software Development] Computoncio:
Did you try this?

Phone: Samsung Galaxy SII - GT-I9100

Kernel: Dorimanx kernel v7.29 JB MALI

1st ROM : RR JB v3.1.2 (Online)

2nd ROM : Empty

MODEM: Modem+RIL - XXLPS

ROOT APP: SuperSu v0.99

MODS: My mods, ASUL v4.2 and JusTunBeam v6.0
[Android Software Development] bgcngm:
The same problem over and over... Make sure you IF'ed the framework files.

Run this first:

apktool if framework-res.apk

If you have more framework resource files make sure you do the same. ;)
[Android Software Development] cojo11:
yes,i try this,but nothing change,same errors
[Android Software Development] bgcngm:
Which framework resource files do you have on your /system/framework folder? It must be framework-res.apk and at least one more...
[Android Software Development] CosmicDan:
You're missing a framework. The last error says so. You need to install all framework APK's from the ROM you want to use apktool on.
[Android Software Development] cojo11:
on the Phone??

framework-res.apk

framework.jar

framework2.jar

all in system/framework here are only 2 apk`s the framework-res.apk and lg-res.apk

befor ICS comes,i have GB and all works fine,nerver have a problem

also in XDA online kitchen i got this error
[Android Software Development] bgcngm:
There you go... You need to install those two files, by doing this:

apktool if framework-res.apk
apktool if lg-res.apk

Afterwards you will be able to decode what you want. ;)
[Android Software Development] cojo11:
nope,donst work

C:\apktool>apktool if lg-res.apk
Exception in thread "main" brut.androlib.AndrolibException: java.io.FileNotFound
Exception: lg-res.apk (Das System kann die angegebene Datei nicht finden)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:481)
at brut.androlib.Androlib.installFramework(Androlib.java:447)
at brut.apktool.Main.cmdInstallFramework(Main.java:199)
at brut.apktool.Main.main(Main.java:72)
Caused by: java.io.FileNotFoundException: lg-res.apk (Das System kann die angege
bene Datei nicht finden)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:449)
... 3 more
[Android Software Development] bgcngm:
Do you know what you're doing?

Read the error: "Das System kann die angegebene Datei nicht finden". You need to have the file in the working directory.
[Android Software Development] cojo11:
shure i know what iam doing!! its not the first time that i work with apktool

with GB works all fine,but with the new ICS (about 2 weeks old) nothing work

---------- Post added at 02:41 PM ---------- Previous post was at 02:18 PM ----------

so, got it,is delete alle what is framework an lg res from pc,restart and do it again and now its look that works all

thx
[Android Software Development] cojo11:
so,i delete all framework and lge res thinks and now its work,i can decompile

BUT

Cant compile again,what in hell LG are doing
[Android Software Development] TUN_SD:
Hey guys,

I try to compile the new G+ apk, but I get a huge error log but I can´t see the beginning of that log.

is there a way to save the log to text file like a logcat? (adb logcat -d > logcat.txt)

or is there a setting in the cmd to see the complete text I missed?

thanks for the help. ;)
[Android Software Development] rayford85:
I'm in the same boat TUN. Even with 0 changes to the apk , it bombs out :(
[Android Software Development] bgcngm:
I am also interested to know more about this. Saving output to a file doesn't work neither does using more command.

apktool b test.apk | more
[Android Software Development] Deadly:
If we are using Linux , then we can change the limit of text lines visible in terminal settings... that would help as a work around right?

Not sure about command prompt though... I don't use it for these purposes..

____________________________________________

ಇದು ನನ್ನ ಆಪ್ ಸಿಗ್ನೇಚರ್

ΧΔΑ Fraternity: TOT Time! & IRC Info

Judge a man by his questions rather than his answers.
[Android Software Development] Mach3.2:
Just wondering, is API 17 supported?
[Android Software Development] raziel23x:
Short answer is no long answer it is being worked on no eta
[Android Software Development] brainmaster:
API 17 decompiles and recompiles just fine. Use the apktool from goo-inside.me that someone posted here.
[Android Software Development] CosmicDan:
You need to use updated aapt in OP.
[Android Software Development] Ibn Saeed:
Can apktool be used to extract the decompiled apk into a workable eclipse project just as APK to Java does it ?

If yes, what would be the commands that i would have to type in ?
[Android Software Development] CosmicDan:
No. It will never be possible to reverse engineer an APK to a 100% working java source -not by APKTool or any tool.

You can use a tool like dex2jar to get java code, but this will never produce working code and is often broken or wrong. But it makes the code more readable as a guide to the smali hacking.
[Android Software Development] Ibn Saeed:
i understand that and know that we wont get 100% working code.

What i meant to say is if a workable code could be produced, in order to understand and learn from the way the app does a particular job.
[Android Software Development] CosmicDan:
I believe that is the goal of APK To Java, as you said. Use that. APKTool is not really designed for that.

Either that, or learn smali. It really isn't that hard to understand - it's just that you need to cross-reference a lot.
[Android Software Development] cojo11:
i use the appt from op
[Android Software Development] iBotPeaches:
@cojo11

Update your aapt. You don't get those errors unless your aapt is out of date. Check all the places of aapt. Mainly wherever Windows stores its exes ( I think Windows/System)

@ Everyone else.

I need someone who has a Windows computer to check in the windows tmp folder if there are tons of APKTOOL_RANDOMNUMBER files there. It appears the auto deletion of the tmp files isn't working. Someone tipped me off to that in the bug tracker, and my /tmp folder had around 80MB of apktool tmp files. Though I'm confused as I believe the its working fine on Windows.

That being said I will release v1.5.1 PR2 ( Preview Release 2) to work out any final kinks before the real v1.5.1 is released. I'm trying to see if the changes I made to recompiling in terms of changed package names affects any old APKs. Testing is going well, I'm aiming for the end of this week.
[Android Software Development] bgcngm:
I can confirm that apktool 1.5.1PR1 is working fine in Windows. Later on I can check my Windows temp folder.
[Android Software Development] CosmicDan:
Heh yeah, I have 1,336 files in %TEMP% with names like "APKTOOL83432945133544769.tmp". Not a big deal because my Temp folder is cleaned on every fresh boot (but I've been hibernating for a few days).
[Android Software Development] cojo11:
its aapt 1.5.0 i think the newist??

i make a Virtual Clean Windows too,got the same errors
[Android Software Development] plegdroid:
do you have an older version sat in sdk?

ⓐⓝⓓⓡⓞⓢⓘⓓⓔ ⓘⓢ ⓝⓞⓣ ⓐ ⓢⓘⓝ
[Android Software Development] cojo11:
no,the same from op
[Android Software Development] plegdroid:
do you have sdk installed?

if yes, sdk comes with a aatp what may be conflicting with the one from the op.

ⓐⓝⓓⓡⓞⓢⓘⓓⓔ ⓘⓢ ⓝⓞⓣ ⓐ ⓢⓘⓝ
[Android Software Development] cojo11:
shure,updatet it yesterday
[Android Software Development] plegdroid:
see above edit. remove the one from the sdk. :)

ⓐⓝⓓⓡⓞⓢⓘⓓⓔ ⓘⓢ ⓝⓞⓣ ⓐ ⓢⓘⓝ
[Android Software Development] cojo11:
change nothing
[Android Software Development] plegdroid:
have you rebooted the pc?

ⓐⓝⓓⓡⓞⓢⓘⓓⓔ ⓘⓢ ⓝⓞⓣ ⓐ ⓢⓘⓝ
[Android Software Development] cojo11:
shure
[Android Software Development] varun.chitre15:
OMG!! I had 500MB of files :p

Awaiting PR2.

btw any luck with Proguard?
[Android Software Development] plegdroid:
this working for me. ive no sdk installed just Java, aapt and apktool. I open command prompt, and the directory that points at I create a folder "apktool", and I place the aapt and apktool into that folder. i also use full commands "java -jar apktool.jar b <apk> <newapk>

:)

ⓐⓝⓓⓡⓞⓢⓘⓓⓔ ⓘⓢ ⓝⓞⓣ ⓐ ⓢⓘⓝ
[Android Software Development] asrock37:
Same here, but I made a weekly clean up to make it more faster, because if not, upon decompiling & compiling it responses very slow,
[Android Software Development] Mach3.2:
For some reason, it's not working for me, using the apktool from op.

D:\Users\*\Downloads\Galaxy Nexus\apktoolsJB>java -jar apktool.jar if
framework-res.apk
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x01080293 drawable/ic_ab_back_holo_dark, config=-xhdpi
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:197)

at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:166
)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:131)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
6)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:40)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:459)
at brut.androlib.Androlib.installFramework(Androlib.java:447)
at brut.apktool.Main.cmdInstallFramework(Main.java:199)
at brut.apktool.Main.main(Main.java:72)

D:\Users\*\Downloads\Galaxy Nexus\apktoolsJB>

Was trying to install the framework-res.apk from CM10.1 for the Galaxy Nexus.
[Android Software Development] bombadier:
I get exactly the same error but with Cataclysm 4.2.1
[Android Software Development] CosmicDan:
@avatar.... Bubbles! You rock!

Sorry, back on topic.... HAD to be said.
[Android Software Development] bombadier:
bubbles does :)

Managed to install framework and decompile systemUI by using the apktool and aapt found in flappjaxxx`s thread
[Android Software Development] Ibn Saeed:
Thanks for the advice.
[Android Software Development] Mach3.2:
Thanks for the heads up!:good:

Ran into trouble again lol!

I guess i'll live with big arse nav bars for the time being..
[Android Software Development] masterex567:
It's not working on Ubuntu for me

This is exactly what I am doing:

1. Chown -R all the files

2. Sudo chmod +x all the files

3. Sudo nautilus

4. Copy the chowned and chmoded files to usr/local/bin

5. Go to terminal

6. Copy framework-res to home folder

7. Apktool if framework-res.apk

"installed framework"

8. Apktool d framework-res.apk

"decompile successfully"

9. Apktool b framework-res

"aapt not found"

To verify if you open terminal anywhere and type apktool it will show you instructions which means that there is a /usr/local/bin/apktool file

But if you type aapt it comes back to the same conclusion:

It cannot locate /usr/local/bin/aapt

It says there is no file like that

If you have it set up on Ubuntu can you attach your /usr/local/bin/aapt here?
[Android Software Development] CosmicDan:
Dude, aapt binary is in the OP. I think the one in faapt folder is newest (rename it).
[Android Software Development] cojo11:
I try it now at 3 fresh installed PCs ( 1 XP and 2 Win7 ) and got every Time the same error

There must somthing wrong with the LG files
[Android Software Development] iBotPeaches:
Haven't looked at Proguard since PR1. JesusFreke said I could just look at smali (since he does it there). So I'm sure if I just look over smali's build files I can figure it out.

PR2 also deletes those tmp files correctly now.
[Android Software Development] masterex567:
Ok.

i got the new aapt from the faapt directory.

Still same issue

help?
[Android Software Development] djmatt604:
Seems fine. There are just some strings that are not translated in your included language packs...those aren't deal breakers for a recompile. Have you tested your apk to see if it works? Give it a shot.