I. Official download cocos2d-2.1beta3-x-2.1.1.rar, unzip, such as cocos2d-2.1beta3-x-2.1.1/
II.
Unzip the folder to see if the cocos2d-2.1beta3-x-2.1.1 owner is the current user, and whether the operation permissions can be read and written.
If not, use either of the following methods
Method 1 (recommended ).
Owner changeProperty-> Security-> advanced-> ower-> edit-> OK
Permission change Property-> Security-> edit-> (everyone or your account) full control-> OK
Method 2.
After the Administrator runs cygwin:
Owner change Chown-r current user name *
Permission change Chmod-r 666 *
Method 3.
CMD
Owner changeTakeown
/F/R folder
Permission changeIcacls why/T/grant Bob :( F)
To adapt to my configuration environment, I made some changes in the create-android-project.bat.
? Set_cygbin = c: \ cygwin \ bin
Cygwin bin path
? Set_androidtools = D: \ Android-SDK-Windows \ tools
Android SDK tools path
? Set_ndkroot = D: \ Android \ android-ndk-r5b
Root directory of ndk
(If ndk_root is still reported to be undefined in the future, try to enter the % cygwin %/home/your account/directory.
Add the following two sentences to the end of. bash_profile and restart cygwin.
Ndk_root =/cygdrive/C/work/android-ndk-r8d
Export ndk_root)
3.
(Note: The following operations are performed in cmd. If Windows 7 is used, run it with administrator. Otherwise, the. Java file may be empty due to permission issues)
Enter the root directory of the cocos2d-x, run the create-android-project.bat, enter the name of the project (such as XXX), and target ID
4.
(Note: The following operations are performed in cygwin. If Windows 7 is used, run the command as administrator. Otherwise, permission issues may occur)
Go to the generated XXX project folder and enter the proj. Android directory.
Cd c:
CD/x/y/z/xxxx/proj. Android
./Build_native.sh
If cc1plus.exe: Fatal error: JNI/hellocpp/Main. cpp: Permission denied
Run
Chmod-r 666 JNI /*
And then execute
./Build_native.sh
If you encounter sharedlibrary: Libgame. So
C:/work/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/Windows/Bi N/../lib/GCC/ARM-Linux-androideabi/4.6/.../ARM-Linux-androideabi/bin/lD.
EXE:
Error: cannot open./obj/local/armeabi/PNG. A: Permission denied
And a large batch of errors, Please execute
Chmod-r 666 OBJ /*
And then execute
./Build_native.sh
4. Open eclipse and introduce XXX as a project.
Modify some minor issues such:
A. the Java version is incorrect. Method 1: andorid tools-> fix project propertMethod 2: Property-> Java compiler-> compiler compliance level 1.6
B. @ drawable/icon-> @ drawable/ic_launcher in androidmanifest. xml
You also need to introduce the libcocos2dx library project, or the cocos2dxactivity cannot be found.
Library engineering location cocos2d-x-2.1.1 \ cocos2dx \ platform \ Android \ Java
V,
Connect to the android real machine,Right-click Project-run as AndroidTo see the little robot.
Sat.
If fatalError: Main is reported during running In eclipse, go to the corresponding project-> properties-> JAVA build path-> order and export Add libcocos2dx. jar, restart eclipse, and run as Android Application