How to make OBB Files or Expansion files

Hi All,

I have been trying to upload a new game to the google play store. When I tried to upload it I got an error message saying I would be able to install apps that are less than 150MB size.
Since my app is around 400MB I had to check for various answers. The final one that I choose to go ahead was using an OBB file.

I am relatively new (5 months in development) to the cocos2dx and I’m finding it very difficult in finding a solution. When I went through the forum I could find a complete solution.

Case1- https://medium.com/terry-engineer/實戰-android-obb-on-cocos2d-x-b600c29e08e7

Tired to follow this post. Even though I didn’t know mandarin I tried to covert everything but still get issues on the first step itself.

Case2- Android APK Expansion Files with cocos2d-x v3

When I went ahead with this thread I couldn’t get a clear idea. I had been gone through around 20-30 post but most don’t have a clear output.

What I have learned.

  1. Need to zip the files in the resource folder
  2. Doubt regarding do I need to edit the Manifest file. If yes what should I do?
  3. In some cases, the developer has created java files to connect with the java files in the app.
  4. If I have successfully created an OBB file. In some threads, it has shown we will face issues when we release the new updates.

It would be great if the community could help me through this roadblock. (I’m also using SDKBox)

Doubts?

  1. If you have any documentation for cocos2dx please share it.
  2. What are the files I need to edit for implementing the OBB file?
  3. Will it affect SDKBOX implementation?
  4. Do I have to edit the Gradle file?
  5. If I make a zip version of the resource then cases for the audio file will cause issues in playing the file.
  6. Do I need to update the current path of resources?

Please help me. @slackmoehrle, @zhangxm, @linyixin, @smitpatel88, @mars3142 would like to create a new tutorial thread if I’m able to crack this step. It’s very dishearting when you have arrived at your destination but unable to enter it.

compileSdkVersion: 26
buildToolsVersion: 28.0.3
minSdkVersion: 16
targetSdkVersion: 26
Android gradle plugin version: 3.4.2
Gradle version: 5.1.1

1 Like

Case 3 method suggested by @mars3142

I have tried to create an OBB file using the following line of code.

a: $cd mySample2/obb-expansion-cocos2dx3.2/
b: $ zip -rn .ogg:.mp3:.wav assets.zip assets/
c: $ mv assets.zip main.2.com.superman.plane.obb
d: $ mkdir com.superman.plane
e: $ mv main.2.com.superman.plane.obb com.superman.plane /

Generated an APK
Inserted the OBB file inside android>obb>package name>main obb file
When I tried to launch the app it gets crash. It’s not getting the mp3 file or the TTF files for the font.
What should I do next?

I have also found a tool called jobb. But in that, there is a need of inserting encryption keys. If we provide that how will we decrypt?

Interested in this @akhilmohan ill bookmark this thread might get useful in the future.

hoping you will get an answer from the pros @slackmoehrle @zhangxm @mars3142

When the last time I used this, it was not supported.

You need to ask runtime permission first for read/write. After that only you can access obb file.
If everything else is fine, then it will work.

Hi @smitpatel88,

Thanks for the reply. I have made an obb file using the following

a: $ cd mySample2/obb-expansion-cocos2dx3.2/
b: $ zip -rn .ogg:.mp3:.wav assets.zip assets/
c: $ mv assets.zip main.2.com.superman.plane.obb
d: $ mkdir com.superman.plane
e: $ mv main.2.com.superman.plane.obb com.superman.plane /

I have spine files, font files and audio files in the resource folder.

I have used the following in the xml file.

android:name=“android.permission.READ_EXTERNAL_STORAGE”
android:name=“android.permission.WRITE_EXTERNAL_STORAGE”

DO I have to add any extra code? Right now I’m getting an error of missing ttf file.

Have you got a solution @akhilmohan ? Im also stuck at the same step as you are. I have added the bob file and also I have edited the xml file. @smitpatel88 @slackmoehrle @mars3142

I’m not much of an android developer. I think others can help more. I’ll ask around to see if anyone on the team has thoughts too.

Thats not what i mean.
Read more about “Android Runtime Permission”

I got it working
I have made the obb files with the contents of the resource folder using the following line of code

zip -rn .ogg:.mp3:.wav …/main.1.com.test.app.obb ./

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.