Hi guys I am new to android application. recently I am developing one application.It works well and fine. But my problem is application contains the audio's and sequence images(nearly 10000 images)by the end of the project apk size is 530 MB. how to create the expansion file for that project. i want to upload the project into play store. please guys anyone help me to create how the expansion files are created for that project.
I follow this website http://developer.android.com/google/play/expansion-files.html but I can not under stand properly. please any help me
An expansion file is typically just a zip archive of the things you want to have in it. Use your favorite ZIP tool to generate it.
Your expansion file name format should be : [main|patch]...obb
Gather all your contents inside a folder and rename the folder as per the naming format above and with .zip as extension.
For eg: main.1.com.your.packagename.zip.
Now you can upload this expansion file along with the apk.
Related
When I googled this question on the Internet, there was none about how to create instead of install. I saw they were just zip files but I do not really know if I can just put everything into a zip and change its file extension to .xapk and it is done. So my question is: Can I simply zip a .apk and a .obb files (build from Unity) to make a .xapk file? Or I need to arrange it with some specific folder structure? Or I can only make it from an Android project in Android Studio?
It seems the answer is NO. It needs an "manifest.json" file, as detailed in Caleb Fenton's blog.
http://calebfenton.github.io/2016/02/28/decompiling-xapk-files/
The question of how to generate the file automatically still eludes me. I haven't been able to find a "xapk creator" or something.
I have read all the documentation about APK Expansion for Android.
I have a simple question:
I have an application that is about 5mb of code and has 40mb of assets files. These assets files will be updated in further release of the app, so I have implemented the APK Expansion.
Now, I have to publish the apk and the obb files on the google play console.
Documentation says that "main" must be used for files necessary to run the app, and "patch" for optional files. In my case my assets file are optionals and will be updated togheter with the app apk code change, so what files I need to upload?
The apk and a file zip named main.<expansion-version>.<package-name>.obb ?
The apk and a file zip named patch.<expansion-version>.<package-name>.obb ?
Or the apk and file zip containing both the two files? In this case which name I had to use?
Thanks in advice
You need to upload the apk and the zip with .zip extension. Google play console will convert to .obb format, you don't need to care about it.
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
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.
Got success in uploading and download the Expansion files Apk external data, Android Expansion
but now I am facing CRC while unzipping my files.
Not getting exactly where the problem is, Google rename my files as .obb
Searching for workaround, if any?
Update
Complete explanation defined here Steps to create APK expansion file
Fixed it, I just skip checking CRC32 algorithm and its working very fine.
I suspect you are having the same problem as this question. In brief, the sample code doesn't work for compressed zip files.