Soomla : Cocos2dx : Store : Android "package not found"

742 views Asked by At

I'm trying to compile Soomla Cocos2dx-store for Android, I used the Git version from yesterday. It's my first time using soomla for cocos2dx/Android. I get strange compilation error: "soomla package not found".

[javac] /COCOS_PROJ/proj.android/src/org/cocos2dx/cpp/AppActivity.java:31: package com.soomla.cocos2dx.common does not exist
[javac] import com.soomla.cocos2dx.common.ServiceManager;
[javac]                                  ^

or like

[javac] /COCOS_PROJ/proj.android/src/org/cocos2dx/cpp/AppActivity.java:42: cannot find symbol
[javac] symbol  : class ServiceManager
[javac] location: class org.cocos2dx.cpp.AppActivity
[javac]         final ServiceManager SOOMLACORE = ServiceManager.getInstance();
[javac]               ^

I use: Cocos2dx v3.3 rc1 / Android SDK API-20 / NDK r10c (compiler 4.9) / ADT (eclipse juno version OSX) / Soomla (core & store) from Git downloaded on 2014-12-02 ( both yesterday)

I followed instructions for integration of soomla at: https://github.com/soomla/cocos2dx-store#instructions-for-android to integrate soomla.

So I did all required on that page and used the [add Jars] from "Java build path" to add : SoomlaAndroidCore.jar / Cocos2dxAndroidCore.jar / square-otto-1.3.2.jar and SoomlaAndroidStore.jar / Cocos2dxAndroidStore.jar then finally AndroidStoreGooglePlay.jar

Even from the terminal "cocos run -p android ....." I get the same error. From Eclipse, I use under "project / c-c++ build / builder/ build command" this command:

/COCOS2DX/v3.3rc1/tools/cocos2d-console/bin/cocos run -p android -s ${ProjDirPath} -m release

Can you help me fixing this problem please?

HEre is the AppActivity.java I use:

package org.cocos2dx.cpp;

import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import com.soomla.cocos2dx.common.ServiceManager;
import com.soomla.cocos2dx.store.StoreService;

public class AppActivity    extends Cocos2dxActivity {
@Override public Cocos2dxGLSurfaceView onCreateView()   {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    final ServiceManager SOOMLACORE = ServiceManager.getInstance();

    SOOMLACORE.setActivity(this);
    SOOMLACORE.setGlSurfaceView(glSurfaceView);
    SOOMLACORE.registerService(StoreService.getInstance());

    return glSurfaceView;
}
....

So under the IDE, Eclipse doesn't detect any errors from the AppActivity.java source. I get error during compilation only

1

There are 1 answers

2
Zenslainer On

Finally I've been able to fix the problem. In fact, on the cocos2dx-store git page, instruction is like that:

  1. Add the following jars from to your android project's classpath:

from extensions/soomla-cocos2dx-core/build/android

SoomlaAndroidCore.jar Cocos2dxAndroidCore.jar square-otto-1.3.2.jar from extensions/cocos2dx-store/build/android

SoomlaAndroidStore.jar Cocos2dxAndroidStore.jar

So I used [add Jars] from "Java build path" to add them. But this not enough. You need also to import all Jars in the "Libs" directory in your Eclipse project. That is where the javac is capable of finding those jars.

So to make it work,

Right click the Libs folder

Click import

Choose in menu : "General / File Systems"

Browse to your soomla directories where jars are located and add them one by one, this way

I hope this can help. And maybe Soomla team should see a work around to that, or update the Git Readme.MD file for better instruction