5

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?

MultiColourPixel
  • 1,222
  • 10
  • 19
User42590
  • 2,473
  • 12
  • 44
  • 85

2 Answers2

8

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.

uncle Lem
  • 4,954
  • 8
  • 33
  • 53
  • thankyou for the great help.. one thing i want to ask is that from where jobb.bat can be download? there is path to tools in SDK but there is no jobb.bat file in tools folder – User42590 Feb 06 '13 at 05:29
  • @Akhter make sure that you've been installed latest Android SDK and Android SDK Platform-tools (I have rev. 21.0.1 and 16.0.1, respectively). I had same problem and I solved it by downloading latest SDK, deleting old one and installing new one - may be it's not the simplest way to fix that problem, but it worked for me. – uncle Lem Feb 06 '13 at 13:46
  • hi! i found obbListner in the provided link with which it should be initilize?? – User42590 Feb 07 '13 at 10:53
  • you should create it in your activity, implement methods for UI update in different cases (e.g. onFilesNotFound means that you have to start download, and onMountSucceess - that mount is finished succesfully) and put it in createNewInstance() method. Then, when you'll need to get file from obb just use getInstance() to get an existing instance – uncle Lem Feb 07 '13 at 12:58
  • hi uncle lem, i got an issue with your code on github. i keep having error state 21 when mounting the obb. can u help me? – Alfa May 13 '13 at 04:42
  • I had this error with mounting encrypted obb files. See http://stackoverflow.com/questions/14342068/how-to-mount-encrypted-apk-expansion-files – uncle Lem May 13 '13 at 10:33
  • @SanketKachhela Use the [JOBB](http://developer.android.com/tools/help/jobb.html), Luke! ;) – uncle Lem Sep 21 '13 at 11:54
  • @uncleLem Your GitHub link says Page Not Found – Nitish Aug 04 '14 at 08:46
  • @Nitish sorry, old link. Here it is: https://github.com/uncleLem/AndroidUtils/blob/master/src/io/github/unclelem/androidutils/utils/ObbExpansionsManager.java – uncle Lem Aug 04 '14 at 20:06
  • after i create obb file from assets , can i delete all assets? – Pavel Poley Mar 27 '18 at 20:47
3

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
benka
  • 4,732
  • 35
  • 47
  • 58
Hitesh
  • 125
  • 2
  • 10