2

My Cocos2d-X game is larger than 50 Mo so as I read on the Android documentation I have to use expansion files. I followed this subject: Android OBB/ZIP loading (cocos2dx) So I modified Cocos2dxHelper.java and placed my OBB file (a renamed Zip file) on my device's sdcard: /Android/obb/com.project.id/com.project.id.obb Unfortunately my OBB file is not loaded. I added theses permissions:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Where is my mistake? Did you succeeded with loading assets from an OBB file? Is there something else to do?

Thanks in advance.

EDIT: Here is the fullpath of my OBB File: /sdcard/emulated/0/com.emedion.games.bardadum/main.1.com.emedion.games.bardadum.obb I read that "/sdcard/emulated/0/" is the correct external storage path since Android 4.2.

I'm testing it on a Nexus 4 with Android 4.4.2.

Community
  • 1
  • 1
TheArsenik
  • 98
  • 2
  • 8
  • Could you post the name of the obb file that you placed and the path to it? I also followed the tutorial that you linked, and I had no problems with it. – Losiowaty Dec 17 '13 at 14:43
  • @Losiowaty I updated my post to mention it. – TheArsenik Dec 17 '13 at 16:32
  • I'm not a 100% sure, but this path may vary by device vendor and you propably want to target your game for more devices than just 4.2+. Try replacing the hardcoded path with `Environment.getExternalStorageDirectory()`. – Losiowaty Dec 18 '13 at 07:51
  • That's exactly what I used – TheArsenik Dec 18 '13 at 08:36
  • Ok, so could you post the changes you made to `Cocos2dxHelper.java`. Also, just in case, did you rebuild the library? The best courrse would be to clean both cocos2dx-lib and your project, then build them one by one. – Losiowaty Dec 18 '13 at 09:18
  • [http://stackoverflow.com/questions/18573096/android-obb-zip-loading-cocos2dx][1] try Answer 2 it work for me. – Muhammad Noman Jun 13 '14 at 14:05

1 Answers1

0

I've downloaded the latest release of Cocos2d-x (v2.2.1), made the modifications mentionned in the thread I mentionned (Android OBB/ZIP loading (cocos2dx)) and it work. I've created a new project and just zipped resources without any code modification. I think the problem was coming from compilation caching or something like that now I have to make my project working.

Thanks for your help.

Community
  • 1
  • 1
TheArsenik
  • 98
  • 2
  • 8