how to use apktool in php (linux)?

584 views
Skip to first unread message

mgh2211

unread,
Sep 30, 2011, 1:58:16 PM9/30/11
to apktool
how to get apk file information
in php (linux)
?

Ryszard Wiśniewski

unread,
Sep 30, 2011, 2:34:53 PM9/30/11
to apk...@googlegroups.com
Run apktool using exec() function - exactly the same as you do from terminal.

mghd

unread,
Oct 1, 2011, 5:57:27 AM10/1/11
to apk...@googlegroups.com
can you send a source please!!!!!!!!!?????????????



Ryszard Wiśniewski

unread,
Oct 1, 2011, 6:21:39 AM10/1/11
to apk...@googlegroups.com

Source of apktool or do you mean example of usage from php?

mghd

unread,
Oct 2, 2011, 12:04:23 PM10/2/11
to apk...@googlegroups.com
php source for use apk tool

Ryszard Wiśniewski

unread,
Oct 2, 2011, 3:13:30 PM10/2/11
to apk...@googlegroups.com
I think you don't understand the problem. PHP example is just:

<?php
exec('apktool d file.apk');
?>

But first you have to install apktool on a server. And you won't be able to run apktool on most web hosting servers because you need Java.

Steven

unread,
Oct 2, 2011, 6:04:29 PM10/2/11
to apktool
Lol, I think they were insinuating that they wanted example usage (ie.
Write everything for them!) ;)

nate

unread,
Oct 2, 2011, 6:38:06 PM10/2/11
to apk...@googlegroups.com
I did something almost exactly like this, not using PHP because of its Swiss cheese security. Instead I used Dropbox and my VPS host since I have full root and could install Java.

Files get SCP'd or Dropbox synced up to a jailed user home folder on my VPS and a more escalated system account executes a script using incron to notify. Apktool runs and the output is put back into my Dropbox folder. 

All I do is upload an app up from my phone with Dropbox. On file system change, incron kicks off a script I wrote that strips out permissions, resigns it and syncs it back.

Here's a full write up I did with complete working code straight off my server. It's not PHP but you can figure it out like I did:

Dipu Ratheesan

unread,
Aug 13, 2013, 2:00:33 AM8/13/13
to apk...@googlegroups.com

Got this error while running apktool, but working fine in terminal, error occurred while calling this through browser

I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionCode, value=0x00000001
W: Could not decode attr value, using undecoded value instead: ns=android, name=versionName, value=0x00000016
Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157)
at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:80)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:130)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:144)
at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:131)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:218)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
Reply all
Reply to author
Forward
0 new messages