Keep your heart with all diligence, For out of it spring the issues of life. (HolyBible Proverb 4:23)
因為一 生的果效是由心發出 (聖經箴言 4:23)
2013-12-20
2013-12-17
Fixing "cocos-ext.h" not found issue
When using the Cocos2d-extension (e.g ScrollView, Button) on my project,
I found that it is okay to compile in Xcode but not in Android;
It said cannot found "cocos-ext.h"
The case is easy because Android.mk in the extension folder is configured wrong;
File location: cocos2d-x/extension/Android.mk
Orignal setting:
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH) \
$(LOCAL_PATH)/GUI/CCControlExtension \
$(LOCAL_PATH)/GUI/CCScrollView
Correct one should: $(LOCAL_PATH) is added
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH) \
$(LOCAL_PATH)/GUI/CCControlExtension \
$(LOCAL_PATH)/GUI/CCScrollView
2013-12-12
Setup Android Project on Cocos2d-x 3.0
Important things need to make cocos2d-x android project running
1. Make sure the Android SDK (ADT) and NDK ready
2. Configure the Android.mk
Need to config the following variables:
- LOCAL_SRC_FILES : Because we may have more sources than the "HelloWorld" project
- LOCAL_C_INCLUDES: The related header files will be searched by the compiler
- LOCAL_WHOLE_STATIC_LIBRARIES: Our project may not need the sdk given
- $(call import-module, moduleName) : Need to match with the LOCAL_WHOLE_STATIC_LIBRARIES
3. Configure the AndroidManifest correctly
Need to config these two variables:- <uses-sdk android:minSdkVersion="9"/> : Need to "9" or above to use Native Activity
- <meta-data android:name="android.app.lib_name" android:value="App" /> : it will link to your native library called "libApp.so"
4. Copy the java source to proj.android
5. Prepare Eclipse to import the android project
Other Troubleshooting
Unable to load native library: "xxx.so"
Problem: Fail to define the native library
Solution: config the library name correctly in AndroidManifest.xml
For example: your library is libs/armeabi/libGame.so
the value defined in AndroidManifest.xml should be like the following:
<meta-data android:name="android.app.lib_name" android:value="Game" />
Note: No need to define the path, extension, and 'lib' prefix;
LogCat said "dvmFindClassByName rejecting 'org/cocos2dx/lib/Cocos2dxHelper"
Problem: Missing the java source folderSolution: http://www.cocos2d-x.org/forums/6/topics/36265
Subscribe to:
Posts (Atom)