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

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

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文件如下:
# from:
APP_STL := c++_static
# to:
APP_STL := gnustl_static 

NDK_TOOLCHAIN_VERSION=clang

APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic

TARGET_cpu_API := armeabi
APP_ABI := armeabi

APP_DEBUG := $(strip $(NDK_DEBUG))
ifeq ($(APP_DEBUG),1)
  APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
  APP_OPTIM := debug
else
  APP_CPPFLAGS += -DNDEBUG
  APP_OPTIM := release
endif
原文链接:https://www.f2er.com/cocos2dx/338704.html

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