1

I successfully imported a simple cocos2d-x 3.10 project(created by cocos studio) by viewing this video https://www.youtube.com/watch?v=gdOkbXYsf04

After a week of developing my app with a lot of codes (on xCode everything run ok). Then when I recompiled my app again using this command first:

cocos compile -p android --android-studio

A lot of errors appeared. I really don't know what is the real reason. Is it coming from my code (all the code was running ok on Xcode) or have I misconfigured something? Has anyone had the same problem as me?

I had simple down my app and here is the error when compile:

image showing error

JSON C11
  • 11,272
  • 7
  • 78
  • 65
phuongho
  • 1,147
  • 2
  • 9
  • 15
  • clear now. you must modify the /proj.android-studio/app/jni/Android.mk. add your cpp file to LOCAL_SRC_FILES. in my case is Box2dTest.cpp. – phuongho Apr 25 '16 at 02:33

2 Answers2

1

First Find the Android.mk file from your_project/proj.android-studio/app/jni/Android.mk then replace follwing code

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp

with this below code

PROJECT_FILES := hellocpp/main.cpp \

PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../../Classes/*.cpp)

PROJECT_FILES := $(PROJECT_FILES:$(LOCAL_PATH)/%=%)

LOCAL_SRC_FILES := $(PROJECT_FILES)

if you created any sub directory in classes folder then please put all your class into the classes folder only never make any sub directory into classes folder. this rule is also apply for Resources folder put your all resources into Resources folder only.this thing is needed for android platform.

0

This is an error related to your Box2DTest class. You may have declared a constructor but have not instantiated it.

Either delete the constructor or instantiate it.

Striker
  • 507
  • 4
  • 11