I am using the expansion files demo given in the sdks and am placing the obb file on the SD Card at the following location:
/Android/obb/package-name/package-name/main.versioncode.package-name.obb
But i get the following error:
XAPK File Validation Failed
For generating the .obb files this is the procedure i have followed :
1) copy all the images to a folder named main.versioncode.package-name.obb and then zip that file.
2) remove .zip file extension and place it in this /Android/obb/package-name/myobbfile.obb
Is this the correct way of doing it?
An OBB file is an uncompressed ZIP file, so make sure that you zip it without compression.
Every ZIP utility should have some sort of compression level option.
The following screenshot is the open source 7-ZIP gui for Add to Archive with a highlight i added to show where the Compression Level is set to Store.
Another way of doing it would be using jobb
Usage
The syntax for running jobb is as follows:
jobb [-d <directory>][-o <filename>][-pn <package>][-pv <version>] \
[-k <key>][-ov][-dump <filename>][-v][-about]
You can use the jobb tool to create an OBB file or extract the contents of an existing OBB. The following example command creates an OBB file from source files.
$ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11
This example shows how to dump (extract) the contents of an existing OBB file:
$ jobb -d /temp/obb-output/ -o my-app-assets.obb -k secret-key
Here is how you need to get it done
1) You can put your images in any custom named folder you want. e.g myimages.
2) put all those images in a zip archive, once done adding rename that archive to main.versioncode.package-name.obb
3) Place that .obb file in directory sdcar/Android/obb/package-name/main.versioncode.package-name.obb
Hope it helps
Related
As the title suggests I want a list of .apk files to be removed from system.img before packaging so that those does not consume file system space on "/" (/system partition).
Basically I want it to be scalable solution so written a shell script to remove those .apks as below:
apk_removal.sh
*#!/bin/bash
REMOVAL_DIR=$1
rm ${REMOVAL_DIR}/system/system_ext/priv-app/xyz1.apk
rm ${REMOVAL_DIR}/system/priv-app/xyz2.apk
...*
How can I use this script to remove the .apk files from system.img just before packaging.
I have many APK (Android package) files in a folder and I want to extract the manifest files from each of them. I am using Android apktool to convert them and since there are many APK files I want to convert them in a loop, not one by one.
apktool d hello.apk ./hello is the command for extracting manifest files from hello.apk and produces the output folder named hello.
I tried the command in the command prompt using for loop in the current directory in which all APK files are stored:
for \r %v in (*.apk) do apktool d "%v" "./%v".
I want the output folder of same name for each APK file, i.e. if APK is hello.apk the output folder should be hello. The above command is producing an error: cannot generate the output folder. How can I extract manifest files from all such APK files at once from a loop?
Maybe you forgot -o parameter?
That command works fine for me:
for /r %v in (*.apk) do apktool.jar d "%v" -o "./%~Nv"
I have implemented expansion file as per the below link:
a link
When i sign and export application it does not create .obb file and not reduce apk size.
When i run the application it show download failed because resource could not be found.
please help me.
Thanks in advance.
The link you have used its for accessing the .OBB files. You have to manually create them by using the following command.
jobb -d pathToFolder -o fileName.obb -k secret-key -pn packageName -pv 1
For more Info See this
I have an apk of 80Mb and so am not able to upload it on google play store. I have googled a lot and found that I have to create .obb file as the main expansion file.
Also I have found that I can create a .obb file using the jobb tool which is inside sdk > tools > jobb.bat but unfortunately it closes just after it starts.
So am I missing something?
i have googled and found that we shold have to make .zip with 0% (No compression) that is mention in http://developer.android.com/google/play/expansion-files.html
Tip: If you're packaging media files into a ZIP, you can use media playback calls on the files with offset and length controls (such as MediaPlayer.setDataSource() and SoundPool.load()) without the need to unpack your ZIP. In order for this to work, you must not perform additional compression on the media files when creating the ZIP packages. For example, when using the zip tool, you should use the -n option to specify the file suffixes that should not be compressed:
zip -n .mp4;.ogg main_expansion media_files
OR How to make 0% compression zip using winrar?
here see the compression method
so we should have to upload this zip in play store.
so you not need to use ZipHelper.java
just simply use
ZipResourceFile expansionFile=null;
try {
expansionFile = APKExpansionSupport.getAPKExpansionZipFile(getApplicationContext(),3,0);
AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor("test.mp4");
MediaPlayer mPlayer = new MediaPlayer();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.setDataSource(fd.getFileDescriptor(),fd.getStartOffset(),fd.getLength());
mPlayer.prepare();
mPlayer.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Try this
$ jobb -d /temp/assets/ -o new-obb-file.obb -k secret-key -pn com.my.app.package -pv 11
Where
-d <directory> : Set the input directory for creating an OBB file.
-o <filename> : Specify the filename for the OBB file.
-k <key> : Specify a password for encrypting a new OBB file
-pn <package> : Specify the package name for the application that mounts the OBB file, which corresponds to the package value specified in your application's manifest.
-pv <version> : Set the minimum version for the application that can mount the OBB file, which corresponds to the android:versionCode value in your application's manifest.
Try this command.
check following link http://developer.android.com/tools/help/jobb.html
I was able to create the OBB file with below command BUT the problem was it was not extracted in app and stuck at ZipInputStream zis zis.getNextEntry()
/Users/rohit/Library/Android/sdk/tools/bin/jobb -d /Users/rohit/Workspace/code/iam/repo/music' 'files -o main.33.com.aml.iatia.activity.obb -pn com.aml.iatia.activity -pv 33
As a solution, I created using CLI in MAC with below command and it worked very fine.
zip -r main.33.com.aml.iatia.activity.obb music' 'files -x "*/\.*"
My app has grown to be over 50mb, so I now need to use an expansion file. On searching I came to know that there are different files that can be used as expansion files such as zip, pdf etc. I am trying to put my data in .obb files but I don't know how to create these files and put the data in these files.
Updated
First:
I found out that jobb tool is used to create obb files. But I am confused how this $ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11 command is run.
I tried to run this ($ jobb -d /temp/assets/ -o my-app-assets.obb -k secret-key -pn com.my.app.package -pv 11 on cmd but my cmd saying jobb is not recognise as internal or external command.
Second:
Which type of files can I put in these obb files? I am thinking layouts, drawable files?
my cmd saying jobb is not recognise as internal or external command
Add /tools to your path or instead of jobb use path/to/sdk/tools/jobb.bat
which type of files are put in these obb files
Big ones. Like drawables, sounds etc. Then, for example, you can use this code to put drawable file into ImageView:
imageView.setImageBitmap(
BitmapFactory.decodeFile(
sm.getMountedObbPath("/path/to/obb/file") +
"path/to/file/in/obb.png")
or, play sound:
mp.setDataSource(AcItem.this,
Uri.fromFile(new File(
sm.getMountedObbPath("/path/to/obb/file") +
"path/to/file/in/obb.png"));
mp.prepare();
mp.start();
As I promised, GitHub link to my obb manager class: https://github.com/uncleLem/AndroidUtils/blob/master/src/io/github/unclelem/androidutils/utils/ObbExpansionsManager.java
I hope it would help.
Just write Like this in command prompt and press enter
C:\>C:\Development\Android\adt-bundle-windows-x86-20140321\sdk\tools\jobb -d C:\
Myworkspace\ImageTargets\assets\ -o Imagetargets.obb -k globe -pn com.ib.globeap
p.activity -pv 200 -v