Cocos2d-x项目在运行时崩溃:在Android Studio emulator中,类加载器引用了未知路径:/data/app/org.cocos2dx.MyFirstGame-1/lib/x86

Cocos2d-x项目在运行时崩溃:在Android Studio emulator中,类加载器引用了未知路径:/data/app/org.cocos2dx.MyFirstGame-1/lib/x86,cocos2d-x,game-engine,Cocos2d X,Game Engine,我正在使用Windows10和Cocos2dx-13.1。我能够使用 cocos compile -p android 13 -m debug 但当我在Android Studio emulator上运行它时,emulator崩溃,我得到以下错误日志: ClassLoader referenced unknown path: /data/app/org.cocos2dx.MyFirstGame-1/lib/x86 10-18 13:37:07.875 10364-10364/org

我正在使用Windows10和Cocos2dx-13.1。我能够使用

cocos compile -p android 13 -m debug
但当我在Android Studio emulator上运行它时,emulator崩溃,我得到以下错误日志:

  ClassLoader referenced unknown path: /data/app/org.cocos2dx.MyFirstGame-1/lib/x86
    10-18 13:37:07.875 10364-10364/org.cocos2dx.MyFirstGameD/AndroidRuntime: Shutting down VM
    10-18 13:37:07.875 10364-10364/org.cocos2dx.MyFirstGameE/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: org.cocos2dx.MyFirstGame, PID: 10364
                                                                             java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.cocos2dx.MyFirstGame-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cocos2dx.MyFirstGame-1/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libMyGame.so"
                                                                                 at java.lang.Runtime.loadLibrary0(Runtime.java:972)
                                                                                 at java.lang.System.loadLibrary(System.java:1530)
                                                                                 at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
                                                                                 at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
                                                                                 at android.app.Activity.performCreate(Activity.java:6664)
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                                                                                 at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                 at android.os.Looper.loop(Looper.java:154)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
我认为这个错误是问题的根源,但我不知道如何修复它:

ClassLoader referenced unknown path: /data/app/org.cocos2dx.MyFirstGame-1/lib/x86

发生此错误的原因是您没有为x86体系结构编译cocos2d-x

Application.mk文件中更改为:

APP_ABI := armeabi armeabi-v7a x86

然后重新编译并测试。

发生此错误是因为您没有为x86体系结构编译cocos2d-x

Application.mk文件中更改为:

APP_ABI := armeabi armeabi-v7a x86

然后重新编译并测试。

我听说您正在使用Android Studio。Android Studio目前还不支持Cocos2d-x。你不能仅仅依靠他们的模拟器来运行你的APK。我建议在真实设备上进行测试或使用Bluestacks模拟器


我想这已经在中突出显示了。

我听说你正在使用Android Studio。Android Studio目前还不支持Cocos2d-x。你不能仅仅依靠他们的模拟器来运行你的APK。我建议在真实设备上进行测试或使用Bluestacks模拟器

我认为这一点在本文中得到了强调