Unfortunately hellocpp has stopped

Hi,

I’ve successfully built hellocpp (and the other examples) on a Mac with Android/NDK/Eclipse. No errors, some warnings.

But when I run it (on both simulator and Android device) I get “unfortunately hellocpp has stopped”

What else do I need to do?

Thanks,

I got the same problem. How to debug this problem?

Did you follow the tutorial http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_build_and_run_HelloWorld_on_Android(gles20_branch) ?
Could you paste the output in Logcat window?

Same problem for me :frowning:

Hi guys, which version of cocos2d-x are you using?
Could you please upload an .apk which can raise this failure in this thread, so we can find the problem.

I fixed the problem by add the following lines in Cocos2dxActivity.java:

// …add to FrameLayout
framelayout.addView(this.mGLSurfaceView);

// NOTICE: to comment it out when you release the application
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);

The problem is because Android emulator can’t support OpenGL ES 2.0 well. But my “solution” is a only a temporary one when you run application in emulator. (The app is fine when I run the app in real device.)

I have the same problem, and installing the app on a real device doesnt help it.

Using the latest version of Cocos2dx

This is the error i get in LogCat:
02-25 07:19:13.461: E/AndroidRuntime(2218): FATAL EXCEPTION: main
02-25 07:19:13.461: E/AndroidRuntime(2218): java.lang.ExceptionInInitializerError
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.Class.newInstanceImpl(Native Method)
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.Class.newInstance(Class.java:1319)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.os.Looper.loop(Looper.java:137)
02-25 07:19:13.461: E/AndroidRuntime(2218): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.reflect.Method.invokeNative(Native Method)
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.reflect.Method.invoke(Method.java:511)
02-25 07:19:13.461: E/AndroidRuntime(2218): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-25 07:19:13.461: E/AndroidRuntime(2218): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-25 07:19:13.461: E/AndroidRuntime(2218): at dalvik.system.NativeStart.main(Native Method)
02-25 07:19:13.461: E/AndroidRuntime(2218): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load hellocpp from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.cocos2dx.hellocpp-1.apk,libraryPath=/data/app-lib/org.cocos2dx.hellocpp-1]: findLibrary returned null
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.Runtime.loadLibrary(Runtime.java:365)
02-25 07:19:13.461: E/AndroidRuntime(2218): at java.lang.System.loadLibrary(System.java:535)
02-25 07:19:13.461: E/AndroidRuntime(2218): at org.cocos2dx.hellocpp.HelloCpp.(HelloCpp.java:37)
02-25 07:19:13.461: E/AndroidRuntime(2218): … 15 more

Same problem here…tried bagus flyer’s suggestions, no dice.

02-25 15:24:06.440: E/AndroidRuntime(915): FATAL EXCEPTION: GLThread 96
02-25 15:24:06.440: E/AndroidRuntime(915): java.lang.IllegalArgumentException: No configs match configSpec
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:838)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:994)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1202)

Blurrrghhh. Can’t even build a blank cocos2d-x project.

Cocos2d-x Version?
WHICH device?
DID U build ndk?
COULD YOU upload the APK file?

PLZ don’t just said the logcat info, PLZ provide more details. Thanks.

coo coo wrote:

Same problem here…tried bagus flyer’s suggestions, no dice.
>
02-25 15:24:06.440: E/AndroidRuntime(915): FATAL EXCEPTION: GLThread 96
02-25 15:24:06.440: E/AndroidRuntime(915): java.lang.IllegalArgumentException: No configs match configSpec
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:838)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:994)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1202)
>
>
Blurrrghhh. Can’t even build a blank cocos2d-x project.

Sorry, I’m new to Android development.

Used the latest beta available. Using an emulated Nexus S I believe. Built NDK, not sure how to acess the apk.

But I was able to eventually get this running.

You require the emulator to use GPU processing and be version 4.2 android. Additionally the first line of bagus hack worked.

Thanks

James Chen wrote:

Cocos2d-x Version?
WHICH device?
DID U build ndk?
COULD YOU upload the APK file?
>
PLZ don’t just said the logcat info, PLZ provide more details. Thanks.
>
coo coo wrote:
> Same problem here…tried bagus flyer’s suggestions, no dice.
>
> 02-25 15:24:06.440: E/AndroidRuntime(915): FATAL EXCEPTION: GLThread 96
> 02-25 15:24:06.440: E/AndroidRuntime(915): java.lang.IllegalArgumentException: No configs match configSpec
> 02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:838)
> 02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:994)
> 02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1348)
> 02-25 15:24:06.440: E/AndroidRuntime(915): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1202)
>
>
> Blurrrghhh. Can’t even build a blank cocos2d-x project.

Cocos2d-x Version?
http://cocos2d-x.googlecode.com/files/cocos2d-2.1beta3-x-2.1.1.zip

WHICH device?
Samsung Galaxy S2 i777 (Real Device)
Nexus 7 (Emulator)

DID U build ndk?
Yes

COULD YOU upload the APK file?
Here is the APK http://www.filedropper.com/cocos2dxtest

Bogus fix did not work for me.

I downloaded your apk package.
After i installed it on my device(Nexus S), there were no application icon on my device.
Please import the project in Eclipse, the tutorial is here(http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_build_and_run_HelloWorld_on_Android(gles20_branch)).

Lorenzo Nuvoletta wrote:

Cocos2d-x Version?
http://cocos2d-x.googlecode.com/files/cocos2d-2.1beta3-x-2.1.1.zip
>
WHICH device?
Samsung Galaxy S2 i777 (Real Device)
Nexus 7 (Emulator)
>
DID U build ndk?
Yes
>
COULD YOU upload the APK file?
Here is the APK http://www.filedropper.com/cocos2dxtest
>
Bogus fix did not work for me.

This is a video of me creating a project and reproducing the issue on Eclipse http://screencast.com/t/z58VqIrspB
And this is the APK resulting out of it http://www.filedropper.com/cocos2dxtest_1 (you can see the icon but it wont start)

I followed step by step the following tutorials:
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_build_and_run_HelloWorld_on_Android(gles20_branch)
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_build_and_run_HelloWorld_on_Android_NDK_r5_and_above
http://www.jesusbosch.com/2012/06/how-to-set-up-android-and-win32-cocos2d.html
http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/

Plus I think I read many different stackoverflow and other forums:


http://getmoai.com/forums/word-puzzle-game-t1553/
http://www.cocos2d-x.org/boards/6/topics/17888
http://www.cocos2d-x.org/boards/6/topics/22183

Still cannot figure out what is wrong with it, and looks like I am not the only one with this problem.

I am about to give up… Has anybody successfully deployed on Android, I have been trying for weeks now…

Same problem here…i tried sample HelloCpp

Seems to be only a Windows issue, I just tried the same exact steps with my Mac and it worked just fine :confused:

I also have the same issue as of Lorenzo on Ubuntu. Any luck guys?

I got Hellocpp to work. The mistake i was doing was not building the project using NDK. After building using NDK it works fine for me on my Galaxy Nexus.

ok,this problem is your VM phone dosn;t use GPU

Hi, I’m new to android develop, and I run into this too, did your guys have an solution or workaround here? Thank you.