Issues in project created by create_project.py


#1

Hi,

When opening in Eclipse the project created by create_project.py, Ecplise reports lots of errors in the main Java file.

For example:

package org.cocos2dx.hellocpp;

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

All these lines are marked as errors.

Any suggestions?

Thanks

Jose


Cocos2d-x 2.2.0 - Installation
#2

have you opened the library project ‘cocos2dx’ ?


#3

yes, I added it to the workspace


#4

Same issue here! main.app also has similar errors. Any idea?


#5

Please checkout
* import cocos2dx/platform/android/java into eclipse
* build the imported project


#6

Thanks! It works:)

I just upgrade from 2.1.4 to 2.2, and I found the CCRenderTexture is lost when app goes to background, not sure why, I created a message about this issue, could you please help look at this? Thanks so much:) http://www.cocos2d-x.org/forums/6/topics/36876

Minggo Zhang wrote:

Please checkout
* import cocos2dx/platform/android/java into eclipse
* build the imported project


#7

Do you remember to update the main.cpp file?


#8

I create a new project using create_project.py, the current main.cpp is:

#include “AppDelegate.h”
#include “cocos2d.h”
#include “CCEventType.h”
#include “platform/android/jni/JniHelper.h”
#include <jni.h>
#include <android/log.h>

#define LOG_TAG “main”
#define LOGD (…) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,VA_ARGS)

using namespace cocos2d;

extern “C”
{

jint JNI_OnLoad(JavaVM vm, voidreserved)
{
JniHelper::setJavaVM(vm);

return JNI_VERSION_1_4;
}

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
{
if (!CCDirector::sharedDirector()->getOpenGLView())
{
CCEGLView view = CCEGLView::sharedOpenGLView;
view->setFrameSize;
AppDelegate
pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}

else
{
ccGLInvalidateStateCache();
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
ccDrawInit();
CCTextureCache::reloadAllTextures();
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}

}

}

Fabio Cunha wrote:

Do you remember to update the main.cpp file?


#9

Hi, I update some info in here:http://www.cocos2d-x.org/forums/6/topics/36876

Thanks

Fabio Cunha wrote:

Do you remember to update the main.cpp file?