Not A zip Archeive Expansion File - android

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.

Related

Convert an apk file to zip file

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

Where can I find resource after installing an apk

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

How to get change the package name without using eclips

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

Is there a difference between typical a ZIP file and an APK file?

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).

How do I change my code to use APK Expansion file?

My application is over 50MB because I use a lot of MP3 files. I typical do this ...
uri = Uri.parse("android.resource://red.cricket.RecordAlbum/" + R.raw.track_001_64kb );
... but if I have to use APK Expansion file I assume the above line of code has to change. But change to what? Any help is greatly appreciated!
Edit 1)
Thanks for your answer Ted. I did create the expansion file like so:
red#ubuntu:~/android/workspace/Album/res/raw$ zip -n .mp3 main.1.com.redcricket.Album.obb *mp3
So what do I do now? rm -f *mp3; cd ../..; ant clean ; ant debug Somehow I do not think that is going to work. Where do I put the main.1.com.redcricket.Album.obb file?
The steps are pretty clearly laid out in the docs. In outline, the steps are:
Remove the .mp3 files from your .apk and put them in an expansion file. Name the expansion file according to the directions. The format of the file can be anything you want, but the docs suggest that for audio files you use an uncompressed ZIP format. Android includes the APK expansion ZIP library that can be used to load .mp3 files directly from a ZIP file without having to unpack it.
Rewrite the app to look for the expansion file in the location
Context ctx = getContext();
String loc = ctx.getExternalStorageDirectory()
+ "/Android/obb/" + ctx.getPackageName();
Write code so that if the file is not there, your app will download it from Google Play, using the Application Licensing service as described in the docs. There's quite a bit of coding and configuration involved in this step.
Access the .mp3 file(s) you want using the APK expansion ZIP library. The docs have examples of loading an MP3 from an expansion file by calling MediaPlayer.setDataSource() with a file descriptor, an offset into the ZIP file, and a file length.
Also see this thread for more details on how to do all this.

Categories

Resources