记cocos2dx 3.2版本打包的一些注意事项

前端之家收集整理的这篇文章主要介绍了记cocos2dx 3.2版本打包的一些注意事项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. <Meta-data android:name="android.app.lib_name"
  2. android:value="cocos2dcpp" />
Cocos2dxActivity.java中的onLoadNativeLibraries下读取AndroidManifest下配置的Meta值后进行.so库的加载
  1. protected void onLoadNativeLibraries() {
  2. try {
  3. ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(),PackageManager.GET_Meta_DATA);
  4. Bundle bundle = ai.MetaData;
  5. String libName = bundle.getString("android.app.lib_name");
  6. System.loadLibrary(libName);
  7. } catch (Exception e) {
  8. e.printStackTrace();
  9. }
  10. }

java.lang.UnsatisfiedLinkError: dlopen failed:unknown reloc type 160

from:
http://developer.adca.sh/article/plugins-android/cocos/1-0-0-cocos/cocos2d-x/

In case you set up your environment withanother version of NDKthan the recommended one (r9d) and got an error on launching the app:

2 unknown reloc type 160

You can try modifying the~/Projects/MyGame/cocos2d/plugin/protocols/proj.android/jni/Application.mkfile with the following:

APP_STL := c++_static
4 APP_STL := gnustl_static
改过后的Application.mk文件如下:
  1. # from:
  2. APP_STL := c++_static
  3. # to:
  4. APP_STL := gnustl_static
  5.  
  6. NDK_TOOLCHAIN_VERSION=clang
  7.  
  8. APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
  9. APP_LDFLAGS := -latomic
  10.  
  11. TARGET_cpu_API := armeabi
  12. APP_ABI := armeabi
  13.  
  14. APP_DEBUG := $(strip $(NDK_DEBUG))
  15. ifeq ($(APP_DEBUG),1)
  16. APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
  17. APP_OPTIM := debug
  18. else
  19. APP_CPPFLAGS += -DNDEBUG
  20. APP_OPTIM := release
  21. endif

猜你在找的Cocos2d-x相关文章