Using Soomla, how to get Cocos2dxGLSurfaceView?

Hi,
I’m using new cocos2dx2.1.2.
And i have in-app purchases to do. So i thought of using the soomla frame work.

During initialization of soomla it needs Cocos2dxGLSurfaceView.
In the .java file there there is no instance of Cocos2dxGLSurfaceView being generated.
So i tried by calling getInstance,

StoreControllerBridge.initialize(Cocos2dxGLSurfaceView.getInstance(),
        new MuffinRushAssets(), "AAA", this);

but app is crashing.

i tried doing this also

 Cocos2dxGLSurfaceView mGLView;
 mGLView = new Cocos2dxGLSurfaceView(this);

 mGLView.setEGLContextClientVersion(2);
 mGLView.setCocos2dxRenderer(new Cocos2dxRenderer());

StoreControllerBridge.initialize(mGLView,
        new MuffinRushAssets(), "AAA", this);

still it is crashing

this is the crash report

05-08 16:31:29.629: E/AndroidRuntime(814): FATAL EXCEPTION: main
05-08 16:31:29.629: E/AndroidRuntime(814): java.lang.ExceptionInInitializerError
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.rz2games.store.EventHandlerBridge.(EventHandlerBridge.java:18)
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.rz2games.store.StoreControllerBridge.initialize(StoreControllerBridge.java:32)
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.rz2games.TankCommander.TankCommander.onCreate(TankCommander.java:55)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.os.Looper.loop(Looper.java:130)
05-08 16:31:29.629: E/AndroidRuntime(814):  at android.app.ActivityThread.main(ActivityThread.java:3687)
05-08 16:31:29.629: E/AndroidRuntime(814):  at java.lang.reflect.Method.invokeNative(Native Method)
05-08 16:31:29.629: E/AndroidRuntime(814):  at java.lang.reflect.Method.invoke(Method.java:507)
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
05-08 16:31:29.629: E/AndroidRuntime(814):  at dalvik.system.NativeStart.main(Native Method)
05-08 16:31:29.629: E/AndroidRuntime(814): Caused by: java.lang.NoClassDefFoundError: com.soomla.store.AndroidBus
05-08 16:31:29.629: E/AndroidRuntime(814):  at com.soomla.store.BusProvider.(BusProvider.java:24)

i think this happened because i couldn’t get the Cocos2dxGLSurfaceView’s object correctly.
can anyone help?

solved it.
i didnt read the stack trace fully.
it said “Caused by: java.lang.NoClassDefFoundError: com.soomla.store.AndroidBus”
so i went up the stack and found a warning saying “superclass of AndroidBus is not found”
and this super class is supposed to be inside a jar file called “square-otto-1.3.2.jar”

and in one of the stackover flow forms they said that .jar file has to be in libs folder (http://stackoverflow.com/questions/6168841/unable-to-resolve-super-class)
so i moved the .jar to libs and it started working :slight_smile:

Didn’t mean to necro but this issue still happens in the latest Soomla. Your solution (copying otto) seems to work.