linux上cocos2dx Android打包环境

android sdk wget -c http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz
  sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z
  sudo apt-get install openjdk-7-jdk
  tar -zxvf android-sdk_r23.0.2-linux.tgz
  echo ‘export ANDROID_HOME="‘$HOME‘/Downloads/android-sdk-linux"‘ >> ~/.bashrc
  echo ‘export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"‘ >> ~/.bashrc
  echo ‘export JAVA_CMD="/usr/lib/jvm/java-7-openjdk-amd64/bin/java"‘ >> ~/.bashrc
     
  andorid sdk manager 更新  
     
     
android ndk wget -c http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin
  chmod 777 android-ndk-r10c-linux-x86_64.bin
  ./android-ndk-r10c-linux-x86_64.bin
     
cocos2dx python setup.py  
  python android-build.py -p 21 cpp-tests
     
     
问题1 解决 Android NDK: ERROR  Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to a missing file 
  参考 http://blog.csdn.net/o_oxo_o/article/details/39377797
  参考 http://blog.csdn.net/lxd211/article/details/23977525
  因为svn服务器上没有上传.a文件。类似的还有可能是.so文件。比如如果用了fmod库,提示找不到fmod库的.so文件的时候,看看svn设置里面的忽略文件类型。一般*.a和*.so都是被忽略的。任意文件夹右击,找到tortoiseSVN->属性(setting)->常规属性,右侧面板下方可看到。
     
 安装cocos工具

 cd cocos2d-x-3.1/tools/cocos2d-console/bin

python install.py

 
创建项目 cocos new testApk -p com.lulu.testApk -l cpp -d /home/melos1305/project/linux_bulid_apk/
编译apk cocos compile -p android --ap 20

 

查看 ~/.bashrc 有环境变量

export ANDROID_HOME="/home/melos1305/android/android-sdk-linux"
#export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms"
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
export JAVA_CMD="/usr/lib/jvm/java-7-openjdk-amd64/bin/java"

# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
export COCOS_CONSOLE_ROOT=/home/melos1305/project/cocos2dx/cocos2d-x-3.1/tools/cocos2d-console/bin
export PATH=$COCOS_CONSOLE_ROOT:$PATH

# Add environment variable NDK_ROOT for cocos2d-x
export NDK_ROOT=/home/melos1305/android/android-ndk-r10c
export PATH=$NDK_ROOT:$PATH

# Add environment variable ANDROID_SDK_ROOT for cocos2d-x
export ANDROID_SDK_ROOT=/home/melos1305/android/android-sdk-linux
export PATH=$ANDROID_SDK_ROOT:$PATH
export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH

# Add environment variable ANT_ROOT for cocos2d-x
export ANT_ROOT=/usr/bin
export PATH=$ANT_ROOT:$PATH

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。