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
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.
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.
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.