cocos2d-x项目在真实设备上崩溃

时间:2014-10-30 11:33:31

标签: java android c++ eclipse cocos2d-x

我正在关注如何在eclipse上运行cocos2d-x项目的本教程(http://www.cocos2d-x.org/wiki/How_to_Build_an_Android_Project_with_Eclipse)。我使用的是Android NDK r10c和cocos2d-x-3.0。它在终端上运行良好,但每次我尝试从eclipse运行到真实设备时,它都会崩溃。我已经尝试了很多故障排除选项,但它仍然无法正常工作

这是logcat:

    10-30 12:23:12.658: E/AndroidRuntime(32241): FATAL EXCEPTION: main
    10-30 12:23:12.658: E/AndroidRuntime(32241): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mole.game/org.cocos2dx.cpp.AppActivity}: java.lang.ClassNotFoundException: Didn't find class "org.cocos2dx.cpp.AppActivity" on path: /data/app/com.mole.game-1.apk
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2229)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread.access$700(ActivityThread.java:165)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.os.Handler.dispatchMessage(Handler.java:99)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.os.Looper.loop(Looper.java:137)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread.main(ActivityThread.java:5455)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at java.lang.reflect.Method.invokeNative(Native Method)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at java.lang.reflect.Method.invoke(Method.java:525)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at dalvik.system.NativeStart.main(Native Method)
    10-30 12:23:12.658: E/AndroidRuntime(32241): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.cocos2dx.cpp.AppActivity" on path: /data/app/com.mole.game-1.apk
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2220)
    10-30 12:23:12.658: E/AndroidRuntime(32241):    ... 11 more

控制台上的消息

    [2014-10-30 12:22:16 - Mole] Android Launch!
    [2014-10-30 12:22:16 - Mole] adb is running normally.
    [2014-10-30 12:22:16 - Mole] Performing org.cocos2dx.cpp.AppActivity activity launch
    [2014-10-30 12:22:16 - Mole] Automatic Target Mode: using device '550fa800'
    [2014-10-30 12:22:18 - Mole] Application already deployed. No need to reinstall.

    [2014-10-30 12:22:18 - libcocos2dx] Could not find libcocos2dx.apk!

    [2014-10-30 12:22:18 - Mole] Starting activity org.cocos2dx.cpp.AppActivity on device 550fa800
    [2014-10-30 12:22:19 - Mole] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mole.game/org.cocos2dx.cpp.AppActivity }

1 个答案:

答案 0 :(得分:0)

使用NDK r9d代替r10,至少对我来说这是解决方案。