My app has a home screen widget. When I power on the phone (from off, not sleep) I get a fatal exception.
04-06 14:33:59.739: ERROR/AndroidRuntime(271): java.lang.RuntimeException: Unable to instantiate receiver com.mytest.myapp.AppWidget: java.lang.ClassNotFoundException: com.mytest.myapp.AppWidget in loader dalvik.system.PathClassLoader[/data/app/com.mytest.myapp-2.apk]
04-06 14:33:59.832: ERROR/AndroidRuntime(269): Caused by: java.lang.ClassNotFoundException: com.mytest.myapp.AppWidget in loader dalvik.system.PathClassLoader[/data/app/com.mytest.myapp-2.apk]
If I click the app to start it again, it works fine. Any idea on what is happening?
It would be useful to see the Manifest.mf, just in case there's a typo lurking in there.
Failing that, the only explanation that leaps to mind is that the phone is trying to launch the app before /data is mounted. Can you reproduce in the emulator?
Phil Lello
Related
For the past few weeks, I have on my crash reporter:
Fatal Exception: java.lang.RuntimeException: Unable to start service com.####.MyService#ef705d8 with Intent { act=HIDE cmp=com.####/.MyService (has extras) }: java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3344)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1583)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
This crash is present on:
all Samsung devices 7.0
all Nexus devices on 7.1.2
Note:
It is not due to a recent update of our application, just an OS updates on theses phones.
It is a very very frequent crashes (by far our biggest).
Our users don't report crashes than before (is this crash actually visible for the user?)
We are not able to reproduce it on our side
As you can see into the stack trace, the code impacted is system only. Not much I can do from my side to try and catch and handle the issue.
I checked the thread Android DeadSystemException but that doesn't help me much.
I know that DeadSystemException is:
The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.
Is there anything we can do but to say "that's system, we cannot do anything"?
When the device is being restarted, you cannot run an app. Any app, not just yours but any given app cannot run when the device is restarting. AFAIK it occurs when you try to do something when the system crashes. Meaning if the system crashes and as it restarts your app starts a service or does something you get that error.
Meaning the exception is not connected to your app, but the Android OS and there is nothing you can do about it.
The crash being related to starting a service is because that is what your app did when the system crashed.
So: The error is something the system threw because your app did something when the system did a run-time reboot. There is nothing you can do about this, as you cannot control the Android OS from an app.
I've had the same issue. I implemented a service that uses the android SensorService. In some point of the time, two things happened but I still don't know which one caused the other. 1) The runtime restarted 2) The android SensorService died. I have implemented a default unhandled exceptions handler because I was debugging some other stuff on my app. I noticed that such handler, at least sometimes was catching that exception.
I followed this tutorial to implement it https://doandroid.wordpress.com/2011/11/19/writing-crash-reports-into-device-sd-card/
So, supposing that you implement this handler and it is actually being called when the system dies, you can add some sort of validations inside the handler such that if the exception is the DeadSystemException, you can set up an alarm to restart your application in let's say, 5 minutes or something.
This is of course not an ideal solution, but at least might be a workaround to your problem until you figure out what is really going on with the system.
Some information about how to restart you app programmatically:
Force application to restart on first activity
Your app crashed because of android OS system dies.
Here is the reference.
https://developer.android.com/reference/android/os/DeadSystemException
The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.
since a few days we observe a rapid increase of an unnusual exception when the user uses our app with the Samsung S4 (the error does not appear on other devices).
We could not determine the source of the exception but got two indications:
The exception message from the user:
java.lang.RuntimeException: Unable to open socket for UEventObserver
at android.os.UEventObserver.nativeSetup(Native Method)
at android.os.UEventObserver.access$000(UEventObserver.java:41)
at android.os.UEventObserver$UEventThread.run(UEventObserver.java:179)
A dialog with the title Prevention information appears after the app has crashed.
Updating the policy ends with the error message Update failed due to network issues.
After a google search i found the information that there are other apps like whats app with the same issue but unfortunately without solutions.
Does anyone know this issue or a solution for this problem?
I have an app on Amazon that sometimes (less than 1% of installations) crashes, which is reflected in Crash Reports. Obviously, I don't have access to the actual devices where the app crashed. Below is one of the crash reports. Can anything be done to identify the cause of the crashes?
java.lang.RuntimeException
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:2672)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:2690)
at android.app.ActivityThread.access$2100(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:964)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:850)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException
at android.app.Activity.missingDialog(Activity.java:2636)
at android.app.Activity.dismissDialog(Activity.java:2621)
at com.amazon.android.framework.prompt.Prompt.dismissDialog(Unknown Source)
at com.amazon.android.framework.prompt.Prompt.dismiss(Unknown Source)
at com.amazon.android.framework.prompt.PromptManagerImpl.finish(Unknown Source)
at com.amazon.android.framework.prompt.PromptManagerImpl.a(Unknown Source)
at com.amazon.android.framework.prompt.i.a(Unknown Source)
at com.amazon.android.n.e.a(Unknown Source)
at com.amazon.android.n.b.a(Unknown Source)
at com.amazon.android.framework.context.d.a(Unknown Source)
at com.amazon.android.framework.context.d.onDestroy(Unknown Source)
at com.amazon.android.Kiwi.onDestroy(Unknown Source)
at air.com.sierravistasoftware.SightWordsSB1.AppEntry.onDestroy(AppEntry.java)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:2659)
... 11 more
You are having problems dismissing a dialog. Maybe the problem comes when the dialog is started, the device orientation is changed and the activity is recreated without the dialog. In this case, if you try to dismiss the dialog, the app will crash.
Try replicating it to see if this is the problem.
You may prefer using DialogFragment to avoid this problem or simply catch the exception and move on, as you got what you were looking for (your dialog dismissed).
UPDATE:
Your error log states that it's trying to dismiss a missing dialog when the activity is being destroyed. It could be an issue in the com.amazon.android.framework source code, and maybe the users get prompted for something before the crash.
You could try to replicate situations when your Activity is destroyed.
Following our chat via the comments, I can't think in anything else without seeing the code, so I encourage you to use a bug tracking system to help you find under what conditions is your app crashing.
Try ACRA:
ACRA is a library enabling Android Application to automatically post their
crash reports to a GoogleDoc form. It is targetted to android
applications developers to help them get data from their applications
when they crash or behave erroneously.
I have a class that extends the application class and sometimes in my developer console I see an error saying ClassNotFoundException
java.lang.RuntimeException: Unable to instantiate application ecm2.android.ActiveStore: java.lang.ClassNotFoundException: ecm2.android.ActiveStore
at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4221)
at android.app.ActivityThread.access$1400(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4918)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: ecm2.android.ActiveStore
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
... 11 more
This is how I declare it in my manifest
<application
android:name=".ActiveStore"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
ActiveStore is just a class that holds an application context to start and cancel alrams so why would I get this error?
Update:
I am still seeing this error from time to time in my developer page even after putting a . infront of the class name. It seems to only happen on an update or new install
Probably because you're missing the dot in front of the class name (which helps to tell Dalvik that your class belongs to the package of your app)
.ActiveStore
But if in doubt, post both the whole Manifest file and your .java
In your manifest you should either have something like:
package="path.to.project.root"
...
<application
android:name=".MyApplication"
or as has been mentioned already
<application
android:name="path.to.project.root.MyApplication"
Also make sure the constructor of your MyApplication class is public.
I'm also seeing this problem a lot and have no explanation.
I've seen people saying that it can happen AFTER a crash. Supposedly, after a crash, the ClassLoader could be in a "bad" state and not be able to load classes.
Basically this would mean that a prior bug is the real source of this problem.
Sorry to be vague, please update if you find a more precise explanation.
If you have code that needs to run on startup (e.g. a BroadcastReceiver on BOOT_COMPLETED or an AppWidget), you can get this if the user has installed your app on an external SD card. At this point the SD card may not have been mounted yet, thus your Application class can't be loaded. You can solve this by setting the installation mode to internalOnly or in the case of the BroadcastReceiver wait for the broadcast of ACTION_MEDIA_MOUNTED. See android intent for sdcard ready
I have experienced this before when I extended or implemented one of the classes/interfaces that was not available in a particular api level.
It doesn't tell this in a proper way.
I have seen this when there are verify errors for a different class the class in question depends on. Scroll back and see if there are any verification errors in the full logcat output.
If ecm2.android.ActiveStore depends on a class that fails verification, then you would get a class not found for ecm2.android.ActiveStore, not for the class ecm2.android.ActiveStore depends on.
Have you tried using the fully qualified package name to reference your class in your manifest?
.ActiveStore
would become
com.myapp.package.ActiveStore
By any chance are you using ProGuard or anything similar to obfuscate your code?
I received >>>THIS<<< error log from a client. I replaced the app name with: APP_NAME. Can you help me determine if it was my app's fault? It seems to me that something went wrong outside my app and caused the error in a service:
06-30 15:54:51.059 W/ActivityManager( 427): Scheduling restart of
crashed service
com..android/.services.periodic.GpsLoggerService
But I'm not sure if it was the real cause of the error message. Was it?
The log was taken and sent by an external tool. Log collector. So it's not just a log from my app, but from whole system.
Looking at the pastebin, I can definitely say for certain is seems your app has b0rk3d up. Look at lines 457-465 which shows the
java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
06-30 15:54:51.049 D/Process (11724): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
06-30 15:54:51.049 D/Process (11724): dalvik.system.NativeStart.main(Native Method)
Something happened in the thread there, perhaps, mishandling the thread management, also at line 804 your broadcast receiver, perhaps received some intent, which is causing your app to crash as a whole.
I know its not much help but hope it helps you in the right direction.