When I exit my game by Gdx.app.exit() on android device it gives me App has stopped message
Is this a proper way to exit a libgdx app ?
and Are assets disposed by this way ? I put Assets.dispose() in my game class dispose() method
It gives me this exception
java.lang.NullPointerException at com.badlogic.gdx.backends.android.AndroidInput.lookUpPointerIndex(AndroidInput.java:802) at com.badlogic.gdx.backends.android.AndroidMultiTouchHandler.onTouch(AndroidMultiTouchHandler.java:64) at com.badlogic.gdx.backends.android.AndroidInput.onTouch(AndroidInput.java:429) at android.view.View.dispatchTouchEvent(View.java:7793) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2027) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2027) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2287) at android.view.ViewGroup.cancelAndClearTouchTargets(ViewGroup.java:2128) at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2686) at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3201) at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5810) at android.view.ViewRootImpl.die(ViewRootImpl.java:5783) at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:348) at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:303) at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:84) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3776) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5345) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644) at dalvik.system.NativeStart.main(Native Method)
The problem was in touchDown() method of InputListener which I used to addListener to exit button
I replaced it by clicked() of ClickListener and it solved the problem
Related
The following error is obtained when running my app using the Kinvey client library:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.api.client.http.apache.ApacheHttpTransport
at com.kinvey.android.Client$Builder.newCompatibleTransport(Client.java:555)
at com.kinvey.android.Client$Builder.<init>(Client.java:609)
at ch.ethz.nervousnet.trialapp04.MainActivity.onCreate(MainActivity.java:94)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2337)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2425)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
at dalvik.system.NativeStart.main(Native Method)
The Line in MainActivity class it points to is the following:
Global.setmKinveyClient(new Client.Builder(this.getApplicationContext()).build());
// Client if a library class, not the one I have created
It works on most phones, but on some phones does not work, what could be the cause?
Here is a screen shot of all the libs I have in the project :
Any help is appreciated, thank you.
LoveMeow,
What is the Android version on phones where it is not working? Is it the same version or happens randomly?
Since it is working for you on some phones, all the dependent libraries seem to be added properly. Are there any other warnings that are being thrown?
Thanks,
Pranav
Kinvey Support
I am using RxBus which is an RxJava clone of Otto/EventBus to communicate between the different components of my android app. The app works fine on my Motorola Moto x 2013 running ICS, without crashes. But on a Nexus 5X, running Android M, it throws this exception:
Fatal Exception: java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:60)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by rx.exceptions.OnErrorNotImplementedException: [EventProducer public xyz.chanl.radio.events.Events$StageProgram xyz.chanl.radio.fragments.ProgramListFragment.stageProgram()] has been invalidated and can no longer produce events.
at rx.Observable$27.onError(Observable.java:8139)
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
at rx.internal.operators.OperatorSubscribeOn$1$1.onError(OperatorSubscribeOn.java:59)
at rx.Observable.unsafeSubscribe(Observable.java:8321)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.IllegalStateException: [EventProducer public xyz.chanl.radio.events.Events$StageProgram xyz.chanl.radio.fragments.ProgramListFragment.stageProgram()] has been invalidated and can no longer produce events.
at com.hwangjr.rxbus.entity.ProducerEvent.produceEvent(ProducerEvent.java:98)
at com.hwangjr.rxbus.entity.ProducerEvent.access$000(ProducerEvent.java:17)
at com.hwangjr.rxbus.entity.ProducerEvent$1.call(ProducerEvent.java:80)
at com.hwangjr.rxbus.entity.ProducerEvent$1.call(ProducerEvent.java:76)
at rx.Observable.unsafeSubscribe(Observable.java:8314)
at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(NativeStart.java)
i have googled, but nobody seems to have had this issue before or i cant find an even remotely similar stacktrace.
How can i investigate this problem?
I register and unregister the bus in the onStart and onStop functions of the fragment.
So, I investigated and I realized this normally happens when you register multiple producers emitting the same event. So when the producer is registered with a particular event it invalidates the second one. I don't know if this design was intentional.
I have an Android app used Facebook for login.
However, I got some user bug reports reporting "java.lang.NoSuchMethodError" when doing facebook initialization.
java.lang.NoSuchMethodError: Landroid\/os\/Handler;.
at android.support.v4.content.l.(LocalBroadcastManager.java:110)
at android.support.v4.content.k.(LocalBroadcastManager.java:110)
at android.support.v4.content.LocalBroadcastManager.getInstance(LocalBroadcastManager.java:102)
at com.facebook.internal.BoltsMeasurementEventListener.open(BoltsMeasurementEventListener.java:53)
at com.facebook.internal.BoltsMeasurementEventListener.getInstance(BoltsMeasurementEventListener.java:70)
at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:169)
at my.app.MyApplication.onCreate(MyApplication.java:119)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4464)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718)
at dalvik.system.NativeStart.main(Native Method)
What would be the possible cause of this issue?
I am too late to answer (Help to others) but I solved this problem and I am not sure if it can work for others too.
I added a release key hash together with the debug key hash in the developers.facebook.com/................
and it worked.
Lets see if it works for others too.
I'm compiling a new project through proj.android-studio using:
cocos compile -p android --android-studio
But when I start app on android device, it shows me a message:
Unfortunately, libcocos2dx has stopped
Can you help me? What I'm doing wrong?
Here is logcat:
09-07 12:07:47.711 23074-23074/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: org.cocos2dx.TestGame, PID: 23074
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "srand" referenced by "libcocos2dcpp.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:553)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:288)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:303)
at android.app.Activity.performCreate(Activity.java:5343)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5341)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)
Usually the app stops working if your code contains errors.
Are there errors in your code? What does the LogCat say?
I used commonsguy/cwac-camera for a custom camera view, image capturing is working fine, but when trying to start recording video, the app crashed.
My Stack trace is this,
java.lang.RuntimeException: getParameters failed (empty parameters)
at android.hardware.Camera.native_getParameters(Native Method)
at android.hardware.Camera.getParameters(Camera.java:2112)
at com.commonsware.cwac.camera.CameraView$OnOrientationChange.onOrientationChanged(CameraView.java:658)
at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
at android.hardware.SystemSensorManager$ListenerDelegate$1.handleMessage(SystemSensorManager.java:261)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5391)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Activity is strictly in portrait mode, recording is working fine in MOTO G, but not in Samsung Tab and Micromax, getting same error.
Also I used latest version of "commonsguy/cwac-camera"
One Micromax Device Model is A114 (4.2.2) where i getting the error