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?
Related
I have a main activity and I call a second "demo from android studio" activity when I click on a button of the first activity like this :
public void createNetworkButtonClicked (View view) {
Intent intent = new Intent(this, WiFiDirectActivity.class); // that works
startActivity(intent); // that does not work
}
I get this error :
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3698)
at android.view.View.performClick(View.java:4222)
at android.view.View$PerformClick.run(View.java:17337)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
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:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
Thanks for your help
There can be possibly two reasons for it.
1) Check your method name in onClick attribute of XML file. It should match with the name of the method in java.
2) Create an activity instead of creating individual XML file and Java file for the second class. You can create Activity by right clicking on app folder-->new-->activity-->empty activity.
this stacktrace was submitted to my project issue tracker.
As you there is no references to my code, so does anybody know how to fix it?
I'm using support library v19.0.1 and I can provide more details about device/platform if need
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1343)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:486)
at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:179)
at android.support.v7.app.ActionBarActivity.onBackPressed(ActionBarActivity.java:250)
at android.app.Activity.onKeyUp(Activity.java:2099)
at android.view.KeyEvent.dispatch(KeyEvent.java:2575)
at android.app.Activity.dispatchKeyEvent(Activity.java:2329)
at android.support.v7.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchKeyEvent(ActionBarActivityDelegateICS.java:250)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3344)
at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3317)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2464)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
First change i made is
getSupportFragmentManager().beginTransaction()
.add(R.id.container,new CatListFragment(null)).commitAllowingStateLoss();
Second change is intercept onPause onStop and onResume for the activity, maintain a flag if application is in paused state(or any other way). Intention is not to call .commit() or .commitAllowingStateLoss() in paused state. Once app is resumed you can call the FragmentManager commit. Worked for me :)
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
I'm seeing this exception in my android Market Developer Console -->Crash errors
java.lang.NullPointerException
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:398)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:366)
at android.widget.AbsListView.obtainView(AbsListView.java:1943)
at android.widget.ListPopupWindow$DropDownListView.obtainView(ListPopupWindow.java:1143)
at android.widget.ListView.makeAndAddView(ListView.java:1756)
at android.widget.ListView.fillDown(ListView.java:656)
at android.widget.ListView.fillSpecific(ListView.java:1314)
at android.widget.ListView.layoutChildren(ListView.java:1587)
at android.widget.AbsListView.onLayout(AbsListView.java:1794)
at android.view.View.layout(View.java:9330)
at android.view.ViewGroup.layout(ViewGroup.java:3795)
at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
at android.view.View.layout(View.java:9330)
at android.view.ViewGroup.layout(ViewGroup.java:3795)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1201)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1944)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:126)
at android.app.ActivityThread.main(ActivityThread.java:3998)
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)
Here are the things which i don't understand about this error:
Where is it coming from (i don't see any reference to my classes in this trace)?
Does it mean the application shuts down because of this errors?
What is the mechanism by which this error gets logged in market place?
Note : there are no user messages in the error log.
Looks like either it expects a TextView in your layout which is not there, or an item in your list is null. The relevant source is at http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.5_r1/android/widget/ArrayAdapter.java#ArrayAdapter.createViewFromResource%28int%2Candroid.view.View%2Candroid.view.ViewGroup%2Cint%29, line 398 corresponds to line 355 on this page.
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.