cocos2d-x (Android)之-那些常见的error记

转自:http://blog.csdn.net/callchunli/article/details/8929813

(2013/9/2)

build.xml:939: java.lang.ArrayIndexOutofBoundsExcption:1 at com.android.ant.DependencyGraph.parseDependencyFile<DependencyGraph.java:180> at com.android.ant.DependencyGraph.<init><DependencyGraph.java:54> at com.android.ant.SingleDependencyTask.initDependencies<SingleDependencyTask.java:87> ..... 解决:不觉得代码哪里出了问题,于是重新建了个项目,将代码全部拷贝过去,重新ant debug果然生存成功!

(2012/8/30)——cygwin

1、Using prebuilt externals
cygwin warning:
  MS-DOS style path detected: D:\sdk\ndk/ndk-build
  Preferred POSIX equivalent is: /cygdrive/d/sdk/ndk/ndk-build
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
解决:
 
 
 
2、D:/cocos2dx/cocos2dx/projects/HMD_TD/proj.android/../../../extensions/CCBReader/CCBReader.cpp:390:52: warning: multi-character character constant [-Wmultichar]
Compile++ thumb  : cocos_extension_static <= CCControlButtonLoader.cpp
解决:



3、Your group is currently "mkpasswd".  This indicates that   the /etc/passwd (and possibly /etc/group) files should be rebuilt.   See the man pages for mkpasswd and mkgroup then, for example, run   mkpasswd -l [-d] > /etc/passwd   mkgroup  -l [-d] > /etc/group   Note that the -d switch is necessary for domain users.   bash: build_ajsc_emulator.sh: command not found   产生原因:原来的windows系统用户名与新装的系统用户名不一样所致
解决: 3.1. 按照提示运行 $ mkpasswd -l > /etc/passwd $ mkgroup  -l > /etc/group 重启cygwin.bat。 3.2.也可以直接修改/etc/passwd,把里面涉及到原系统用户名的地方都更新为现在的用户名。


(2013/8/28)——cygwin

 

1、./build_native.sh  error:
解决: 环境配置下NDK_MODULE_PATH 路径指定错误cocos2dx\platform\third_party\android\prebuilt

 

2、cygwin warning:
  MS-DOS style path detected: C:\sdk\ndk/ndk-build
  Preferred POSIX equivalent is: /cygdrive/c/sdk/ndk/ndk-build
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Android NDK: ERROR:/cygdrive/d/sdk/cocos2d/projects/HuntersMustDie/proj.android/../../../cocos2dx/platform/third_party/android/prebuilt/libjpeg/Android.mk:cocos_jpeg_static: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /cygdrive/d/sdk/cocos2d/projects/HuntersMustDie/proj.android/../../../cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a exists  or that its path is correct
make: 进入目录“/cygdrive/d/sdk/cocos2d/projects/HuntersMustDie/proj.android”
/cygdrive/c/sdk/ndk/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting    。 停止。
make: 离开目录“/cygdrive/d/sdk/cocos2d/projects/HuntersMustDie/proj.android”
解决: 没有了cocos2d-x下的platform/third_party...


(2013/8/27) ——cygwin

1、Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
解决: NDK指定的版本与minSdkVersion不一致,找到proj.android目录下的AndroidManifest.xml,修改其minSdkVersion值  如<uses-sdk android:minSdkVersion="9"/>

 

2、error: 'BYTE' does not name a type
解决:程序代码BYTE类型


(2013/8/17)——cocos2d-x-2.1.4

 

1、打包.apk报错:
[javac] C:\sdk\cocos2d\projects\Helloworld\proj.android\gen\com\cocos2d-x\org\R.java:8:错误:需要“;” [javac] package com.cocos2d-x.org; Build FAILED: C:\sdk\sdk\tools\ant\build.xml:710: The following error occurred while executing this line: C:\sdk\sdk\tools\ant\build.xml:723: Compile failed; see the compiler error output for details. 解决: 包名cocos2dx写成cocos2d-x

 

2、sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var 解决1:不可行 android update project --name projectName -t 8-p projectPath 找到project.properties文件中 android.library.reference.1=../../../cocos2dx/platform/android/java
将其注释掉# 没什么作用
解决2:可行 在项目下加一个local.properties文件,里面指定   sdk.dir=C:\\sdk\\sdk

 

3、用python生成项目报错: C:\sdk\cocos2d\tools\project-creator>python create_project.p y -project HelloWorld -package com.cocos2d-x.org -language cpp File "create_project.py", line 27 print "Usage: create_project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE"
^ 4、SyntaxError: invalid syntax
解决:使用python版本是2.7.3 并将其加入系统变量Path:C:\Python27; 是你安装的python后的绝对路径

 

5、打包.apk报错:
C:\sdk\cocos2d\projects\Helloworld\proj.android>ndk-build NDK_DEBUG=1 Android NDK:WARNING:I gnoring unknown import directory :C:\sdk\cocos2d\ Android NDK:WARNING:I gnoring unknown import directory :C:\sdk\cocos2d\cocos2dx \platform\third_party\android\prebuilt Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ? Android NDK: The following directories were searched: Android NDK: jni/Android.mk:23: *** Android NDK: Abborting.  .  Stop. C:\sdk\cocos2d\projects\Helloworld\proj.android> 解决

 

6、(cygwin环境配置)

 

6.1
error:bash --c 无效
打开Cygwin.bat, @echo off C:// cygwin路径 chdir c:/cygwin/bin bash --login -i解决: C:// cygwin路径
 
6.2 
please define NDK_ROOT 解决: 找到cygwin安装目录下.bash_profile文件,添加下2句: NDK=/cygdrive/c/sdk/ndk export NDK
 

 

 

 

7、打包.apk报错:

 

jni/../../Classes/AppDelegate.h:4:21: fatal error: cocos2d.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/hellocpp/main.o] Error
1
C:\sdk\cocos2d\projects\Helloworld\proj.android>
解决: 用cygwin编译so库

 

 

(2013/5/15)
1、error opening trace file: No such file or directory
每次一点击菜单按钮就error opening trace file: No such file or directory
原因1 : android api 的版本和模拟器的版本不一致所导致。
       2 : 缺少资源文件(资源命名、资源路径、或根本不存在)

 

2、error:"xxx" does not name a type   
打包apk时报的error,
原因是:之前有的定义过的但是现在不要的类文件未删

 

(2013/5/3)

1、BUILD FAILED: Android Unable to resolve target 'android-8'
在打包.apk的时候报下错误:
BUILD FAILED: Android Unable to resolve target 'android-8' .
这是因为原有project.properties 的 Project target 的版本号与你当前的android环境所支持的AVD版本号不一致,
解决: 打开项目文件project.properties ,修改其 target值,如 target=android-10//(对应的版本) 如果没有project.properties, 自己建立一个。

 

2、ERROR: Cannot find 'make' program. Please install Cygwin make package or define the GNUMAKE variable to point to it.
解决:cygwin没有安装gun make 真机测试直接“闪退”--------内存问题

 

(2013/6/17)

拖动条TableView之Cell显示BUG,每次要拖动了后才显示,即刷新问题(重写OnEnter函数,在OnEnter函数里调用刷新)
拖动条TableView拖动几次就乱了(重写了OnEnter函数,而没有重写OnExit函数)
构造(){}
OnEnter(){}
OnExit(){}
析构(){}

 

(2013/8)

 

java或者Javac命令不是内部或者外部命令的问题。 解决:jdk环境配置用户变量 CLASSPATH变量值: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jarJAVA_HOME变量值:C:\Program Files \Java\jdk1.7.0(安装的Jdk的位置)

 

系统变量 Path:%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\sdk\ndk;C:\sdk\sdk\tools;C:\sdk\sdk\platform-tools;C:\sdk\ant\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files \Java\jdk1.7.0

你可能感兴趣的:(cocos2d-x)