I am currently working on an application that is being launched as an intent. Here are the flags I am using:
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); // don't "zoom", etc. the launch
intent.setFlags(PendingIntent.FLAG_UPDATE_CURRENT);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
This works great, however if you open and close it fast over and over I get this error:
04-15 17:47:05.190: ERROR/AndroidRuntime(13515): FATAL EXCEPTION: main
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy#408fe608 is not valid; is your activity running?
at android.view.ViewRoot.setView(ViewRoot.java:530)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:424)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2170)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
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:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
I have done some research and understand that a lot of people have this issue. Most people get this error because they use a dialog with an application context. My application does not have any dialogs. I am using a this reference throughout my app. I have also placed some logs to determine where it is crashing. It happens after onResume is done.
Has anyone else had this issue?
I get this above that error.
04-15 17:47:05.190: WARN/WindowManager(2233): Attempted to add application window with unknown token HistoryRecord
Related
I've spent the entire day attempting to fix this, please find the stack trace below, coming from the Google Play Services lib. I changed nothing, i rebuilt the app today and ever since have been given this error. I've tried upgrading GPS to the latest version, rebuilding GPS, downgrading GPS to a previous version, removing various other libraries, explicitly adding the permission it requests and other such niceties... but NOTHING.
if ANYONE can please lend some advice i'd be forever grateful.
java.lang.RuntimeException: Unable to instantiate service
com.google.android.gms.analytics.service.AnalyticsService: java.lang.SecurityException: attempting to
read gservices without permission: Neither user 10064 nor current process has
com.google.android.providers.gsf.permission.READ_GSERVICES. at
android.app.ActivityThread.handleCreateService(ActivityThread.java:1929) at
android.app.ActivityThread.access$2500(ActivityThread.java:117) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:985) 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:895) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653) at dalvik.system.NativeStart.main(Native
Method) Caused by: java.lang.SecurityException: attempting to read gservices without permission:
Neither user 10064 nor current process has
com.google.android.providers.gsf.permission.READ_GSERVICES. at
android.app.ContextImpl.enforce(ContextImpl.java:1289) at
android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1318) at
android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:395) at
imq.c(SourceFile:107) at imq.a(SourceFile:121) at blw.a(SourceFile:276) at blu.b(SourceFile:203) at
blo.c(SourceFile:135) at com.google.android.gms.analytics.service.AnalyticsService.<init
(SourceFile:53) at java.lang.Class.newInstanceImpl(Native Method) at
java.lang.Class.newInstance(Class.java:1409) at
android.app.ActivityThread.handleCreateService(ActivityThread.java:1926) ... 10 more
In my Activity, I try to launch a particular video:
Intent intent = YouTubeStandalonePlayer.createVideoIntent(this, key, videoId);
startActivity(intent);
The video id is LT5YThKAsic, but right after the standalone player activity shows up (I can just briefly see my video there), I get a Force Close with the following stack trace which I don't think is all that helpful.
FATAL EXCEPTION: main
java.lang.IllegalArgumentException
at com.google.android.youtube.core.utils.s.a(SourceFile:112)
at com.google.android.youtube.core.async.GDataRequestFactory.a(SourceFile:395)
at com.google.android.youtube.api.ab.a(SourceFile:141)
at com.google.android.youtube.core.async.a.d.a(SourceFile:101)
at com.google.android.youtube.core.async.a.d.a(SourceFile:73)
at com.google.android.youtube.core.player.Director.v(SourceFile:530)
at com.google.android.youtube.core.player.Director.a(SourceFile:398)
at com.google.android.youtube.core.player.Director.a(SourceFile:412)
at com.google.android.youtube.core.player.Director.a(SourceFile:425)
at com.google.android.youtube.api.ApiPlayer.a(SourceFile:195)
at com.google.android.youtube.api.service.a.d.run(SourceFile:167)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4134)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Force finishing activity com.google.android.youtube/.api.StandalonePlayerActivity
Any idea why it's crashing?
I've been getting the following error, reported via Market developer console by the users of my app:
java.lang.RuntimeException: Failed to register input channel. Check logs for details.
at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
at android.view.ViewRoot.setView(ViewRoot.java:568)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:465)
at android.app.Dialog.show(Dialog.java:241)
at my.program.MyActivity.handleFailure(Unknown Source)
at my.program.MyActivity$RunFailed.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
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:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)
Italicized lines are part of my code. The code in question just creates and shows a dialog. It is run from a Runnable posted to a Handler. Everything should be happening in the GUI thread (that's why Handler is used).
I don't know how to debug this. I haven't experienced this problem myself, and all I have is just a bunch of automated reports. Google shows up a couple of threads on this exact problem, but no answers (except a hint of this being an Android 2.3.3-specific problem).
This may be a Launcher Pro issue. LP is a home replacement. It appears Launcher Pro does not release some resources as it should. Check out this answer here
Does anyone know what this could possibly mean? Apparently someone else's app caused mine to crash? And it happens to be an app that directly competes with mine:
java.lang.RuntimeException: Unable to create BackupAgent com.MY_COMPEITOR'S_APP.backup.BackupAgent: java.lang.NullPointerException
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:2905)
at android.app.ActivityThread.access$4000(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2128)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.app.ActivityThread$PackageInfo.initializeJavaContextClassLoader(ActivityThread.java:529)
at android.app.ActivityThread$PackageInfo.getClassLoader(ActivityThread.java:474)
at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:2873)
... 10 more
TenFour I would bet since you are talking about a competing App that there must be some INtent Handling going on that led to this. Maybe the Competitor app was actually trying to do something at the same time your app was trying to do something and they clashed. Without knowing more it's hard to provide a more detailed answer
I'm new in Android development, and my English is awfull.
I have an application with a homescreen widget.
When I start application, in main activity, I can select options for widget (these options are saved to a DB).
Then, I add a Widget, that it have an ImageButton on it, to the homescreen. The click on ImageButton works fine.
If I kill the application activity with some Task Manager, delete the widget, and add it again. The click on ImageButton crash.
Is this normally?
Here you have the error:
java.lang.RuntimeException: Unable to start service cat.aat.quoteswidget.Widget$UpdateService#45d1b188 with Intent { cmp=cat.aat.quoteswidget/.Widget$UpdateService }: java.lang.NullPointerException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3282)
at android.app.ActivityThread.access$3600(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2211)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at cat.aat.quoteswidget.Widget$UpdateService.buildUpdate(Widget.java:130)
at cat.aat.quoteswidget.Widget$UpdateService.onStart(Widget.java:90)
at android.app.Service.onStartCommand(Service.java:420)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3267)
... 10 more
Thanks!
You have a NullPointerException on line 130 of your Widget.java file, in the buildUpdate() method of your UpdateService.