At first, I have choose an apk named as bdteam. I tried utmost to find the source code. But i can not convert apk file to zip file. How can I solve my problem?
From the documentation:
APK files are a type of archive file, specifically in zip format packages based on the JAR file format, with .apk as the filename extension. The MIME type associated with APK files is application/vnd.android.package-archive.
So .APK are .ZIP files, you don't need any kind of converter, just use WinRAR it will handle them perfectly.
Here's what you want to do:
Right click on the APK file and choose Open with
Select Choose another app
Select WinRAR
Tick Always use this app to open .APK files
This is very easy. Just rename the file to my file.zip and extract by any application.
Just change APK to .zip.
Then change the certain type of file at the bottom to "All Files
then extract
very easy
Related
I know this is possible to decompile and recompile an apk. And I saw this post : Injecting code into APK
before, But what I want is not decompiling or reverse engineering.
In my case I just want to make some games that uses touch events compatible with gamepad. I've seen some companies that do something like this and make android games compatible with their gamepads.
Unfortunately I found no solution to inject some codes into an existing apk.
So My question is :
Is there a way to do some changes into an apk (changing touch and key events in game application) and add some codes into that without effecting the real source code ?
For something simple like this, all you need is baksmali/smali. Just insert a single call into the assembly into your custom class, and you can write the rest in Java.
Decompiling/recompiling rarely works and is overkill for this situation anyway. Using smali will work even for obfuscated applications, though some applications calculate integrity checks on themselves and will refuse to run if modified.
For this purpose first of all you decompile this apk into source code
for decompiling the apk following purpose is used
Step 1:
Make a new folder and copy over the .apk file that you want to decode.
Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it. Now you can access the classes.dex files, etc. At this stage you are able to see drawables but not xml and java files, so continue.
Step 2:
Now extract this .zip file in the same folder (or NEW FOLDER).
Download dex2jar (https://code.google.com/p/dex2jar/downloads/detail?name=dex2jar-0.0.9.15.zip&can=2&q=) and extract it to the same folder (or NEW FOLDER).
Move the classes.dex file into the dex2jar folder.
Now open command prompt and change directory to that folder (or NEW FOLDER). Then write d2j-dex2jar classes.dex and press enter. You now have the classes_dex2jar.jar file in the same folder.
Download java decompiler(http://jd.benow.ca/), double click on jd-gui, click on open file, and open classes.dex.dex2jar file from that folder: now you get class files.
Save all of these class files (In jd-gui, click File -> Save All Sources) by src name. At this stage you get the java source but the .xml files are still unreadable, so continue.
Step 3:
Now open another new folder
Put in the .apk file which you want to decode
Download the latest version of apktool (https://code.google.com/p/android-apktool/downloads/detail?name=apktool1.5.2.tar.bz2&can=2&q=) AND apktool install window (https://code.google.com/p/android-apktool/downloads/detail?name=apktool-install-windows-r05-ibot.tar.bz2&can=2&q= ) (both can be downloaded from the same link) and place them in the same folder
Download framework-res.apk and put it in the same folder (Not all apk file need this file, but it doesn't hurt)
Open a command window
Navigate to the root directory of APKtool and type the following command: apktool if framework-res.apk
apktool d myApp.apk (where myApp.apk denotes the filename that you want to decode)
now you get a file folder in that folder and can easily read the apk's xml files.
Step 4:
It's not any step just copy contents of both folder(in this case both new folder)to the single one
and update the source code...
I want to know how to find a resource in an apk after installing it. I mean, whether Android will extract the apk and save into file system after installing.
By now, I only know apk will is saved in /data/app. classes.dex can be found in dalvik-cache directory. But I don't find any clue about resource in this apk, such as string.xml, png or any file in assets. Is it possible that Android system unpack apk every time when it will use these resource?
I red many old thread, but I don't find answer yet. So can anyone please explain it for me?
Thanks very much in advance.
br
The resources are inside the apk file as binary xml files. Also after the installation. For simple xml files it will load them only from the apk file. Images and larger file might be cached, but I don't know exactly where.
only resources in res/raw folder will be available on device storage, otherwise it will be inside the apk as binary data
To explore an Android APK file,
[ View the graphics, play the audio, etc.]
all you have to do,
is right click on an APK file,
and set it to "Open With" to WinZip, Winrar.
or your favorite unzipper.
Thereafter, any time you click on an APK file,
you can view the graphics, play the audio,
view the resources, explore the programming, etc.
If you want to convert an APK file to Linux/Unix,
download "Dex2Jar" from
http://code.google.com/p/dex2jar/
then unzip one of the APK files
to a convenient directory,
navigate to the directory
and right click on the CLASSES.DEX file,
and set it to "Open With" "dex2jar".
Thereafter, anytime you click on an Android DEX file
this will convert the Android DEX file
to a Unix JAR file and put it in the directory
with the Android resources.
--
Tom Potter
I was lose my android project and i was just only the apk file which is only on publish on google play store.my quation is that any kinde of formula or trick is available to get my source code and i was change the package name and uploade it again..
Try these free programs...
http://www.xda-developers.com/android/easily-decompile-and-recompile-apks-with-android-apktool/
Dex2jar
Android .apk file is a compressed form of a file which contains only Java classes (in .dex form), xml files.
To get the source code from apk file, you can use tools like
dex2jar
apktool
You can look into this link for a detailed explanation.
Of course you can do reverse engineering, but you will not get the exact source code. Because as google announce that whenever you upload apk to market google play runs a proguard on it so whenever anybody try to reverse engineering no body can exact code. It makes your class name Like class A, class B and for loop converts to while loop and and change the variable name to unreadable form.
Please go through it, it gives you all the resources and source code of application. Now you are free to change the package name and so on..
Procedure for decoding .apk files, step-by-step method:
Step 1:
Make a new folder and put .apk file in it (which you want to decode). Now rename the extension of this .apk file to .zip (eg.: rename from filename.apk to filename.apk.zip) and save it.
If problems in the converting into .zip please refers link
After getting .zip now you get classes.dex files, etc. At this stage you are able to see drawable but not xml and java files, so continue.
If you don’t see the extensions go through check the configuration
Step 2:
Now extract this zip apk file in the same folder. Now download dex2jar from this link
and extract it to the same folder. Now open command prompt and change directory to that folder.
Then write dex2jar classes.dex and press enter. Now you get classes.dex.dex2jar file in the same folder.
Then download java de-compiler from
and now double click on jd-gui and click on open file. Then open classes.dex.dex2jar file from that folder. Now you get class files and save all these class files (click on file then click "save all sources" in jd-gui) by src name. Extract that zip file (classes_dex2jar.src.zip) and you will get all java files of the application.
At this stage you get java source but the xml files are still unreadable, so continue.
Step 3:
Now open another new folder and put these files
put .apk file which you want to decode
download Apktool for windows v1.x And Apktool
install window using google and put in the same folder
download framework-res.apk file using google and put in the same folder (Not all apk file need framework-res.apk file)
Open a command window
Navigate to the root directory of APKtool and type the following command:
apktool if framework-res.apk.
Above command should result in Framework installed ....
apktool d "appName".apk ("appName" denotes application which you want to decode) now you get a file folder in that folder and now you can easily read xml files also.
Step 4:
Finally we got the res/ as well as java code of project which is our target at starting.
Enjoy and happy coding
I know a typical APK file would have AndroidManifest.xml but that's not the aspect I ask for. I'm asking in terms of ZIP structure and headers, i.e. at a lower level perspective.
Any APK file is a valid ZIP file. There's more to it than that - files that must be present, the fact that zipalign is normally used to align data structures within the file - but it's all valid ZIP.
AFAIK, it is a completely standard ZIP file. I have had no problems working with an APK as a ZIP file using any tool I have tried.
Note that, as with regular ZIP files, not all entries will be compressed (varies by file type).
I am trying to use Expansion Files in Android. All source is givem in google extras . The only proble is that this code is not reading my .obb file.
How o create .bb file:
first i put my all resources in folder then made it .rar and from jobb tool i made this .rar file as .obb file. But when when i use it in my code the output says not a zip file
As i mention that i research on this topic alot but i did not come to the point so thats why i am asking this question
If your code expects a zip file, you should provide one instead of what jobb generates.
Put your files into a folder and use your favorite zip creator to generate a zip file. Put it onto the device with the correct name main.1.my.package.name.obb.