Re: Running apktool on a device

722 views
Skip to first unread message
Message has been deleted

Jamie Neubert Pedersen

unread,
Jun 19, 2012, 8:31:53 AM6/19/12
to apk...@googlegroups.com
I don't think it's necessary. It's not useful because you don't read or write code on your device anyway, or do you?
Just focus on getting it better on the computer. I think it's a wonderful tool!

Den mandag den 6. september 2010 12.23.17 UTC+2 skrev Ryszard Wiśniewski:
I get questions about that from time to time. My question is: what
for? It would be really hard to modify an app on a 4'' screen and
keyboard (or even without it). I think some of apktool functionalities
should be possible to run on a device without much effort, others
would require performance optimizations of apktool's code or even
porting it to C.

So I want to know:

  * How many people actually need this?
  * What for? Which functionalities are most important for you? Maybe
you need something like NinjaMorph, but with possibility to edit XML
files? And if you want to edit XMLs, there is much technical
difference between values*/*.xml and other ones. Also partial decoding
of XMLs (without attr values decoding - as AXMLPrinter2 and Root
Explorer do) is much easier than full decoding. Is this enough?

Let's talk about it :-)

shan sheng

unread,
Jul 25, 2012, 10:44:54 PM7/25/12
to apk...@googlegroups.com
I don't think it's necessary. 

在 2010年9月6日星期一UTC+8下午6时23分17秒,Ryszard Wiśniewski写道:

Don Page

unread,
Aug 22, 2012, 4:29:40 PM8/22/12
to apk...@googlegroups.com
This is exactly what I need for my mobile security app. I am trying to decode apk files on android device to be able to determine if it is malware. Please I cannot get the source code for apktool to work in my android app. Any help would be appreciated.
Message has been deleted

Erick Petrucelli

unread,
Jun 28, 2013, 5:33:04 PM6/28/13
to apk...@googlegroups.com
Unlike everyone else, I believe this would be a feature absolutely interesting, especially now that Tablets with large screens have expanded the possibilities of Android as a work platform. There are even people programming full apps directly inside Android (e.g. with AIDE).

As it would be a big effort, what about the possibility of decompiling just strings.xml, values.xml and plurals.xml at the beggining, enabling translating apps directly inside Android?

There is no app that does this and it's a feature recurrently being asked at many places. From there, the tool could be expanded to decompile everything, it would be a good start. What do you think about?

shlomo abuisak

unread,
Jul 1, 2013, 2:38:42 AM7/1/13
to apk...@googlegroups.com

Erick Petrucelli

unread,
Jul 1, 2013, 10:16:14 AM7/1/13
to apk...@googlegroups.com
Shlomo, we're talking about running apktool inside the phone itself, without a PC.
Your tool is a GUI for Windows, not an Android app.

shlomo abuisak

unread,
Jul 2, 2013, 3:00:54 AM7/2/13
to apk...@googlegroups.com
Well i understand but it is so simple.
If you want the xml files inside an APK
just UNZIP!!! the apk. Apk is a zip file
i guess know that.
Use any unzip on the phone.
As for the DEX file it is a different matter.
P.S unzipping you get all files except the source
which is dex.
Or may be i still did not understand you?

Ryszard Wiśniewski

unread,
Jul 2, 2013, 5:03:45 AM7/2/13
to apk...@googlegroups.com
Did you try to open any XML file unzipped from apk? I guess not :-)




--
You received this message because you are subscribed to the Google Groups "apktool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apktool+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

shlomo abuisak

unread,
Jul 3, 2013, 2:23:23 AM7/3/13
to apk...@googlegroups.com
Well are both right
"assets" folder do open OK !!
the others are not
So i wander how  my window
shell dose it. i never gave it a thought
well in due time (i am busy now)  i will look into
since on my program you actually get back
ALL!!! xml correctly

Ryszard Wiśniewski

unread,
Jul 3, 2013, 2:59:34 AM7/3/13
to apk...@googlegroups.com

I don't know neither, magic maybe? ;-) You can use unzip if you like, but still 99% of people aren't Jedi and they need apktool to do most things with apk file, so please don't post messages unrelated to the topic here. Of course you can create another topic and there we can discuss what exactly does apktool, what you can do without it and what you can't.

shlomo abuisak

unread,
Jul 3, 2013, 6:25:18 AM7/3/13
to apk...@googlegroups.com
Ok it is a binary xml
http://en.wikipedia.org/wiki/APK_%28file_format%29
and
http://en.wikipedia.org/wiki/Binary_XML

And there are plenty of java and PY decoders up there
I even found an android -small source for that
BUT i still do not get it the usefulness of decoding
UNDER Android when all the tools are friendly
on a big computer (windows).
I have been developing Android with Eclipse
and tried developing inside my phone with a compiler
and i found it to be a toy. Not serious.
If i want to learn (disassemble)  some one apk what
i do is:
1:On my phone i backup the program with ASTRO.
2.Transfer to dropbox.
3.Load to my PC.
4.use my program to disassemble
5. use on jar more source disassemble like jd-gui.exe


 

Erick Petrucelli

unread,
Jul 3, 2013, 9:11:26 AM7/3/13
to apk...@googlegroups.com
Ok, these steps are what all of us do. No problem with it unless you don't have a "big computer" near you.

There are many cases when we're only with our phone and we'd love keep doing app translations. There're many places when I'm only with my phone and would take advantage of running apktool there.

Also, sometimes we hate the title (caption) and icon of an app and we'd love to change it modifing the apk, without needing to backup it and send it to another machine.

And there are many people arround the world that don't have a "big computer" anymore, because tablets (with Android) have become very powerful.
So I really believe saying it's to easy inside Windows isn't enough.

It's time to have power to decompile binary XML (and of course decompile DEX if possible) then recompile it. Just with Android.

Ryszard Wiśniewski

unread,
Jul 3, 2013, 11:25:05 AM7/3/13
to apk...@googlegroups.com

There aren't "plenty of java and PY decoders" because "binary XML" you are talking about isn't a specific format/standard, but some general idea. There are multiple binary XML formats, some of them are listed on the Wikipedia page linked by you. Android has its own implementation, it isn't used anywhere outside Android and I believe there are only 2 decoders of this format: Android OS itself and apktool. There is also AXMLPrinter2 that pre-dates apktool, but it doesn't decode everything, you will see some raw binary stuff and you won't be able to build it back after modifying it.

And apktool does more than XML decoding:

  - resources.arsc decoding - note there are no res/values*/*.xml files in apk file - they're compiled to resources.arsc entirely. Also resources.arsc stores resources index. If you e.g. unzip apk file and add some XML or PNG files, application will ignore them, because they aren't referenced in resources.arsc. You can verify this very easily.

  - 9.png files decoding - note there are no 1px black margin in 9.png files in apk. 9patch data is compiled into a binary chunk of png file, you can't modify it easily. You may also destroy it by accident: open 9.png with some image editor, save it - voila, at this point png may be already broken (depending on chosen image editor) and you won't even know about it.

  - it integrates smali, introduces project-like approach and gives you quite good working-with-sources feeling. Android Studio even recognizes decoded apk as Android project, it let you use layout editor, string editor, 9patch editor, automatically attaches debugger to proper process, etc.

  - it contains some additional tools, e.g. for debugging smali code

However the most important thing is: apktool makes possible to modify anything you see as normal. There are more tools to look into apk file. Regular zip let you see its contents, assets, etc. AXMLPrinter2 let you partially see contents of binary XML files. Any image editor let you see png files. But if you want to modify something then without apktool you won't be able to:

  - modify res/*/*.xml files
  - modify (or even see) res/values*/*.xml files
  - modify 9patch information of 9.png files or e.g. resize these files
  - you may get problems even when modifying pixel information of 9.png files
  - you can't add, move, remove any res/* files, even res/raw* ones

Before apktool modders were opening XML files with hex editors to do very basic modifications, e.g. change margin from 5dp to 2dp or change some strings. There were many applications ported e.g. from hdpi to mdpi screens with broken all 9.png files (it results with weird looking buttons, etc.), because without apktool it was impossible to resize them properly. More advanced modifications weren't at all possible.

I have only one question to you: did you actually try to modify some apk file without apktool (with changes to XML files, not only assets and/or app code)? Or you didn't try it yourself, but you just *think" it's possible and no problem? Try it, then report back your findings :-)

And I won't talk about the need for running apktool on the Android device. As I said above I personally don't need this feature, but if there are people who would like to do that, then why would I argue with them and say it doesn't make sense?

Erick Petrucelli

unread,
Jul 3, 2013, 12:11:33 PM7/3/13
to apk...@googlegroups.com
Ryszard, your explanations are perfect! Apktool is unquestionably the best tool - and the most essential one.

As I've argued, I believe that there's a justifiable demand to run apktool on Android, ending with the need of a PC. I'm even willing to see it happening and I would like to know what features you think could be adapted easily. And of course, how could we help in some way.

Gerald Baggett

unread,
Jul 3, 2013, 12:14:25 PM7/3/13
to apk...@googlegroups.com

As it stands the up coming apktool which is 2.0 will require java 1.7.x installed and will have aapt built in the question is how to get that requirement inside android os

--

Ryszard Wiśniewski

unread,
Jul 3, 2013, 1:01:41 PM7/3/13
to apk...@googlegroups.com
"As I've argued, I believe that there's a justifiable demand to run apktool on Android, ending with the need of a PC. I'm even willing to see it happening and I would like to know what features you think could be adapted easily. And of course, how could we help in some way."

Erick, I'm not sure if I understand you correctly and/or if you understood my last email (still learning English, sorry!). I mean if there are people who ask about that feature then for me this is a proof that this feature is needed and it would be good to support it. It doesn't really matter if I personally or shlomo abuisak need it, because others do :-)

Gerald, I must admit I didn't think about it when I have added dependency on 1.7 :-/ New language features shouldn't be a problem, because I think they should work with -target 6, but unfortunately we use java.nio.files :-/ Hmm...

Gerald Baggett

unread,
Jul 3, 2013, 1:13:27 PM7/3/13
to apk...@googlegroups.com

Could there not be a way to include the needed binaries  to run properly if ran on android is since java is not truly installed but java script is

Erick Petrucelli

unread,
Jul 3, 2013, 1:21:01 PM7/3/13
to apk...@googlegroups.com
Android SDK is a subset of JDK 6, right? Since java.nio.files is a new package of JDK 7, it's really a problem.
But java.nio is there, so any sort of adaptation could be possible, I think: http://developer.android.com/reference/java/nio/package-summary.html



2013/7/3 Gerald Baggett <razi...@gmail.com>
You received this message because you are subscribed to a topic in the Google Groups "apktool" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/apktool/lSxR7Rsv8PI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to apktool+u...@googlegroups.com.

shlomo abuisak

unread,
Jul 4, 2013, 3:31:21 AM7/4/13
to apk...@googlegroups.com
Ok guise did any one succeed in recompiling the source from disassemble.
I did import a disassembled (with my tool)  project  to Eclipse which
it recognized as a project.
But compiling is a different matter.
So did any one did the compilation? and how? with small?
I am using Eclipse for development.

P.S i am Delphi developer and Eclipse and others do not
come near Delphi IDE and it is peaty.


Ryszard Wiśniewski

unread,
Jul 4, 2013, 3:41:11 AM7/4/13
to apk...@googlegroups.com
I will answer your question, but in another thread - after you create it. 

Liran Barsisa

unread,
Aug 31, 2014, 1:06:06 PM8/31/14
to apk...@googlegroups.com
I'd like to say that I think this tool could be useful for developing certain apps on Android.
Even if it will lack some features, it can help a lot.

I wanted to use it for my app-manager alternative app (link here), but then I noticed there is no link or tutorial about it.
Reply all
Reply to author
Forward
0 new messages