Extract Android application icon using aapt - android

I need to extract the application icon in a APK file.
I'm using aapt to know the icon location inside the APK file.
I'm running aapt dump badging com.example.app.apk:
this command returns me:
(...)
application-icon-120:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-160:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-240:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-320:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-480:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-640:'res/drawable-anydpi-v26/ic_launcher.xml'
application-icon-65534:'res/drawable-anydpi-v26/ic_launcher.xml'
(...)
but as you can see it returns me the location of an XML file which in some way is encrypted. I know this XML file has the real path for the PNG file icon, but I don't know how can I get that real path (or how can I decrypt the XML and then parse it).
Is there any way to get the real path for an application icon inside a APK file with a XML pointing to other location?
Thanks!

Check out this project,
https://github.com/iBotPeaches/Apktool
It can be used to unarchive an APK, including the assets.
apktool d <your>.apk

try extract your apk file with 7-zip and you will get res foulder

Related

Android studio, pass assets file path to another method

I am making an app which use the following java line:
Net dnnNet = Dnn.readNetFromONNX("path\to\file");
As you can see, readNetFromONNX requires path to onnx file.
So I put my onnx file under assest folder, so I can use it at run time.
The problem is I you can only read assets foler with AssestManager and inputstream... the readNetFromONNX needs path...
How do I overcome this probelm? Is there a way to get the path of the file at run time? Maybe other folder?
Thanks from advance

How to get .apk icon path from it's resourceId?

I'm using a nodeJS module to extract informations about an android .apk file, and among the informations i get is the icon's resourceId:
icon: 'resourceId:0x7f0f0000'
How do i find the precise path to the icon file(s) within the .apk using this resource ID?
You can use aapt2's dump command, i.e.
aapt2 dump resources base.apk

Get config.xml file of Cordova applications using Androguard

Is it possible to get the config.xml file that is generated by Cordova based applications using Adroguard?
I cannot find it under the /res folder and it is not listed in the output of get_files() method.
apktool, on the other hand, is able to get the config.xml from the apk that is use it on.
Since it is under res folder, You need to get it by unzipping the file to a temporary directory and then parse it using Axml parser. In get_files(), you must see "resources.arsc" file. The res files are part of that. You can do something like :
config_xml_path = os.path.join(<your apk unzipped path>, 'res', 'xml', 'config.xml')
with io.open(config_xml_path, 'rb') as axml_file:
parsed_axml_file = AXMLPrinter(axml_file.read())
axml_content = parsed_axml_file.get_buff().decode('utf-8)
parsed_axml = minidom.parseString(axml_content.encode('utf-8'))
You might get some errors if the config.xml is badly formatted but I am not including the solution to handle those case. I hope you will get an idea with the above example.

How can I add some resources to android framework?

I want to add some resources to android 5.0 framework,and I added some drawable/anim/layout files to /framework/base/core/res/res,and add "" in the public.xml in values directory,then I use "mm" at "/frameworks/base/core/res" to make a framework-res.apk ,and "adb put framework-res.apk /system/framework" ,but it does not work ,system crashes!
How can I add some resources to framework and it work?
You just add your resources under /framework/base/core/res/res/Resource_Type_Folder/.
Make an entry of your resource in public.xml under /framework/base/core/res/res/values/public.xml
That's it.
Build your image and you can access it from any app using following syntax:
#android:resoure_type/resource_name
BR,
Rahul

How can i open .trace file format(traceview) without DDMS?

I want to save a log of method calls.
Traceview supports that function and I can get .trace file format.
but, I need to open .trace file format without DDMS.
If I can't open .trace file without DDMS, How can I get a log of method calls?
(The best is .txt file format.)
thanks.
It is an old thread.
because I found here, so other guys may need this, too.
Try this:
traceview -r yourtrace.trace > 1.txt
and look 1.txt has any useful thing to u.
"traceview" is a command-line utility. You don't need to launch it from DDMS.
If you just want a text file with times and message names, you can use "dmtracedump -o file.trace".
Well for one, you should just use DDMS it's very simple to work with. Even if you don't have eclipse you can use the one that shipped with the SDK. However, if you already have access to the tracefile.trace then you could simply use Traceview from the SDK. Simply open your command prompt and navigate to your android SDK/tools directory as such: cd C:\Program Files\Android\android-sdk\tools. Once there simply type traceview followed by the filename (can omit .trace) as such: traceview C:\Users\Sino\Desktop\Janky_trace_file. This should open your trace file in a GUI representation with functionality to delve into your method calls.
This is simple.
Eclipse: File --> Open file --> open traveview file (xxxx.trace)
If you have a ".trace" file, just use "traceview " from the command line and you should be able to view the content of the file.
You can generate various graphs with the existing .trace file using the command line tool "dmtracedump". http://developer.android.com/tools/help/dmtracedump.html.

Categories

Resources