Application crashing while video playing on youtube in weview - android

I developed an application in which i am loading my youtube channel in webview and it is working fine as expected. i am able to play videos in small screen as well as full screen mode.
But the issue is if I am putting the application in background while the video is playing in full screen mode and and bringing it on foreground application crashing. I have seen the crash log but it is not showing anything from my code I am not getting what is the reason behind the crash. It is showing the NullPointerException but where it came is a mystery.
Logcat :
08-09 14:21:33.480: E/AndroidRuntime(10157): FATAL EXCEPTION: main
08-09 14:21:33.480: E/AndroidRuntime(10157): java.lang.NullPointerException
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.webkit.HTML5VideoFullScreen.prepareForFullScreen(HTML5VideoFullScreen.java:187)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.webkit.HTML5VideoFullScreen.access$600(HTML5VideoFullScreen.java:24)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.webkit.HTML5VideoFullScreen$2.surfaceCreated(HTML5VideoFullScreen.java:124)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.SurfaceView.updateWindow(SurfaceView.java:609)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:235)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.View.dispatchWindowVisibilityChanged(View.java:7678)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:1047)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1335)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.Choreographer.doCallbacks(Choreographer.java:555)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.Choreographer.doFrame(Choreographer.java:525)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.os.Handler.handleCallback(Handler.java:615)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.os.Looper.loop(Looper.java:137)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
android.app.ActivityThread.main(ActivityThread.java:4898)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
java.lang.reflect.Method.invokeNative(Native Method)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
java.lang.reflect.Method.invoke(Method.java:511)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
08-09 14:21:33.480: E/AndroidRuntime(10157): at
dalvik.system.NativeStart.main(Native Method)
Application is not crashing if i am putting application in background while video is playing in small screen only.

Related

App crashes on startup on android API 10 but not on API 16 because of Resources$NotFoundException

My app launches and starts fine on my Samsung Galaxy S3 phone running Android 4.1.2, but when I try to test the same app on my Motorola Droid X running Android 2.3.4 the app crashes before anything is even displayed on my Droid X screen.
My LogCat is below. Unfortunately, it does not point me to exactly what part of my code it is failing on, but it seems like something to do with my layout because of these exceptions:
08-09 10:43:39.686: E/AndroidRuntime(3192): FATAL EXCEPTION: main
08-09 10:43:39.686: E/AndroidRuntime(3192): android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
08-09 10:43:39.686: E/AndroidRuntime(3192): Caused by: java.lang.reflect.InvocationTargetException`
08-09 10:43:39.686: E/AndroidRuntime(3192): Caused by: android.content.res.Resources$NotFoundException:
Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
Log Cat:
08-09 10:43:39.686: E/AndroidRuntime(3192): FATAL EXCEPTION: main
08-09 10:43:39.686: E/AndroidRuntime(3192): android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-09 10:43:39.686: E/AndroidRuntime(3192): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.AbsListView.obtainView(AbsListView.java:1456)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ListView.makeAndAddView(ListView.java:1821)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ListView.fillDown(ListView.java:686)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ListView.fillFromTop(ListView.java:754)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.ListView.layoutChildren(ListView.java:1670)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.AbsListView.onLayout(AbsListView.java:1286)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:702)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.layout(View.java:7184)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.os.Looper.loop(Looper.java:130)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.app.ActivityThread.main(ActivityThread.java:3806)
08-09 10:43:39.686: E/AndroidRuntime(3192): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 10:43:39.686: E/AndroidRuntime(3192): at java.lang.reflect.Method.invoke(Method.java:507)
08-09 10:43:39.686: E/AndroidRuntime(3192): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-09 10:43:39.686: E/AndroidRuntime(3192): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-09 10:43:39.686: E/AndroidRuntime(3192): at dalvik.system.NativeStart.main(Native Method)
08-09 10:43:39.686: E/AndroidRuntime(3192): Caused by: java.lang.reflect.InvocationTargetException
08-09 10:43:39.686: E/AndroidRuntime(3192): at java.lang.reflect.Constructor.constructNative(Native Method)
08-09 10:43:39.686: E/AndroidRuntime(3192): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-09 10:43:39.686: E/AndroidRuntime(3192): ... 35 more
08-09 10:43:39.686: E/AndroidRuntime(3192): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.content.res.Resources.loadDrawable(Resources.java:1719)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.view.View.<init>(View.java:1951)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.TextView.<init>(TextView.java:453)
08-09 10:43:39.686: E/AndroidRuntime(3192): at android.widget.TextView.<init>(TextView.java:446)
08-09 10:43:39.686: E/AndroidRuntime(3192): ... 38 more
08-09 10:43:42.201: I/Process(3192): Sending signal. PID: 3192 SIG: 9
Fixed!!
Looking into it more and it looks like it had something to do with the ArrayAdapter as well as my layout. I was using a custom layout (drawer_list_item.xml) for my ArrayAdapter which had some ICS specific code I am guessing, so I just had to remove some lines from that XML file and the app launched fine on Android API 10 (specifically Android 2.3.4). The lines specifically in my layout file that caused problems was:
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
Here is the code in my SherlockFragmentActivity that was causing the layout exception/crash:
m_drawerList.setAdapter(new ArrayAdapter<String>(getSupportActionBar().getThemedContext(),R.layout.drawer_list_item, m_drawerNames));
OLD drawer_list_item.xml code:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"<!-- Deleted line-->
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#fff"
android:background="?android:attr/activatedBackgroundIndicator"<!-- Deleted line-->
android:minHeight="?android:attr/listPreferredItemHeightSmall"/> <!-- Deleted line-->
FIXED drawer_list_item.xml code:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="16dp"
android:textColor="#fff" />
Are you using ActionBarSherlock or HoloEverywhere? I've experienced this problem a lot when using those libraries and trying to style/theme things.
Basically, some attributes are specified by default in ICS+, but are not specified in older versions of android. So, you have to mirror resources, as shown here:
http://actionbarsherlock.com/theming.html
Posting your code for the themes/styles might be helpful for us to see whats wrong.
Without more code I cannot tell you exactly why the app is failing. All we know is that you might use some feature available only for higher APIs. Post your xml-layouts and maybe your classes.
However, try to include the Support Library. That often solves the problem.

Runtime error while launching facebook android app

I was following the tutorial given at https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/
While trying to create the Android Project with Facebook login as given in section 6, I am stuck with the following error as shown in LogCat:
08-09 15:48:56.556: I/dalvikvm(378): Could not find method com.facebook.Session.getActiveSession, referenced from method com.example.myfirstandroidapplication.MainActivity.onActivityResult
08-09 15:48:56.576: W/dalvikvm(378): VFY: unable to resolve static method 27: Lcom/facebook/Session;.getActiveSession ()Lcom/facebook/Session;
08-09 15:48:56.576: D/dalvikvm(378): VFY: replacing opcode 0x71 at 0x0003
08-09 15:48:56.576: D/dalvikvm(378): VFY: dead code 0x0006-000a in Lcom/example/myfirstandroidapplication/MainActivity;.onActivityResult (IILandroid/content/Intent;)V
08-09 15:48:56.586: I/dalvikvm(378): Failed resolving Lcom/example/myfirstandroidapplication/MainActivity$1; interface 25 'Lcom/facebook/Session$StatusCallback;'
08-09 15:48:56.586: W/dalvikvm(378): Link of class 'Lcom/example/myfirstandroidapplication/MainActivity$1;' failed
08-09 15:48:56.586: E/dalvikvm(378): Could not find class 'com.example.myfirstandroidapplication.MainActivity$1', referenced from method com.example.myfirstandroidapplication.MainActivity.onCreate
08-09 15:48:56.586: W/dalvikvm(378): VFY: unable to resolve new-instance 10 (Lcom/example/myfirstandroidapplication/MainActivity$1;) in Lcom/example/myfirstandroidapplication/MainActivity;
08-09 15:48:56.586: D/dalvikvm(378): VFY: replacing opcode 0x22 at 0x0009
08-09 15:48:56.636: D/dalvikvm(378): VFY: dead code 0x000b-0010 in Lcom/example/myfirstandroidapplication/MainActivity;.onCreate (Landroid/os/Bundle;)V
08-09 15:48:56.717: D/AndroidRuntime(378): Shutting down VM
08-09 15:48:56.717: W/dalvikvm(378): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-09 15:48:56.736: E/AndroidRuntime(378): FATAL EXCEPTION: main
08-09 15:48:56.736: E/AndroidRuntime(378): java.lang.NoClassDefFoundError: com.example.myfirstandroidapplication.MainActivity$1
08-09 15:48:56.736: E/AndroidRuntime(378): at com.example.myfirstandroidapplication.MainActivity.onCreate(MainActivity.java:28)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.os.Looper.loop(Looper.java:123)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-09 15:48:56.736: E/AndroidRuntime(378): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 15:48:56.736: E/AndroidRuntime(378): at java.lang.reflect.Method.invoke(Method.java:521)
08-09 15:48:56.736: E/AndroidRuntime(378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-09 15:48:56.736: E/AndroidRuntime(378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-09 15:48:56.736: E/AndroidRuntime(378): at dalvik.system.NativeStart.main(Native Method)
08-09 16:22:11.456: I/dalvikvm(402): Could not find method com.facebook.Session.getActiveSession, referenced from method com.example.myfirstandroidapplication.MainActivity.onActivityResult
08-09 16:22:11.456: W/dalvikvm(402): VFY: unable to resolve static method 27: Lcom/facebook/Session;.getActiveSession ()Lcom/facebook/Session;
08-09 16:22:11.466: D/dalvikvm(402): VFY: replacing opcode 0x71 at 0x0003
08-09 16:22:11.466: D/dalvikvm(402): VFY: dead code 0x0006-000a in Lcom/example/myfirstandroidapplication/MainActivity;.onActivityResult (IILandroid/content/Intent;)V
08-09 16:22:11.476: I/dalvikvm(402): Failed resolving Lcom/example/myfirstandroidapplication/MainActivity$1; interface 25 'Lcom/facebook/Session$StatusCallback;'
08-09 16:22:11.476: W/dalvikvm(402): Link of class 'Lcom/example/myfirstandroidapplication/MainActivity$1;' failed
08-09 16:22:11.507: E/dalvikvm(402): Could not find class 'com.example.myfirstandroidapplication.MainActivity$1', referenced from method com.example.myfirstandroidapplication.MainActivity.onCreate
08-09 16:22:11.507: W/dalvikvm(402): VFY: unable to resolve new-instance 10 (Lcom/example/myfirstandroidapplication/MainActivity$1;) in Lcom/example/myfirstandroidapplication/MainActivity;
08-09 16:22:11.507: D/dalvikvm(402): VFY: replacing opcode 0x22 at 0x0009
08-09 16:22:11.507: D/dalvikvm(402): VFY: dead code 0x000b-0010 in Lcom/example/myfirstandroidapplication/MainActivity;.onCreate (Landroid/os/Bundle;)V
08-09 16:22:11.696: D/AndroidRuntime(402): Shutting down VM
08-09 16:22:11.706: W/dalvikvm(402): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-09 16:22:11.716: E/AndroidRuntime(402): FATAL EXCEPTION: main
08-09 16:22:11.716: E/AndroidRuntime(402): java.lang.NoClassDefFoundError: com.example.myfirstandroidapplication.MainActivity$1
08-09 16:22:11.716: E/AndroidRuntime(402): at com.example.myfirstandroidapplication.MainActivity.onCreate(MainActivity.java:28)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.os.Looper.loop(Looper.java:123)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-09 16:22:11.716: E/AndroidRuntime(402): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 16:22:11.716: E/AndroidRuntime(402): at java.lang.reflect.Method.invoke(Method.java:521)
08-09 16:22:11.716: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-09 16:22:11.716: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-09 16:22:11.716: E/AndroidRuntime(402): at dalvik.system.NativeStart.main(Native Method)
I have also tried every possible search here and tried resolving library dependencies but still can't get out of this error.
I am also attaching a screen shot of facebook sdk reference error, if it can help you in suggesting me a solution.1
If there is solution to this problem in another thread then please direct me towards the link.

Android app closes unfortunately

I am using eclipse with libGdx framework... And Everything is set... But only when i am Run android through emulator after launching when i click on App icon it gives me a message "UNFORTUNATELY APP-NAME HAS STOPPED"... Please tell me why this is happening... Because same code works when i run as Desktop java Application through Eclipse... Please help me out... Thanks...
LOG CAT DETAILS :
08-09 19:30:45.729: W/dalvikvm(747): Unable to resolve superclass of Lcom/badlogic/drop/MainActivity; (20)
08-09 19:30:45.739: W/dalvikvm(747): Link of class 'Lcom/badlogic/drop/MainActivity;' failed
08-09 19:30:45.759: D/AndroidRuntime(747): Shutting down VM
08-09 19:30:45.759: W/dalvikvm(747): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
08-09 19:30:45.779: E/AndroidRuntime(747): FATAL EXCEPTION: main
08-09 19:30:45.779: E/AndroidRuntime(747): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.badlogic.drop/com.badlogic.drop.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.drop.MainActivity" on path: /data/app/com.badlogic.drop-2.apk
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.os.Looper.loop(Looper.java:137)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-09 19:30:45.779: E/AndroidRuntime(747): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 19:30:45.779: E/AndroidRuntime(747): at java.lang.reflect.Method.invoke(Method.java:511)
08-09 19:30:45.779: E/AndroidRuntime(747): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-09 19:30:45.779: E/AndroidRuntime(747): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-09 19:30:45.779: E/AndroidRuntime(747): at dalvik.system.NativeStart.main(Native Method)
08-09 19:30:45.779: E/AndroidRuntime(747): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.drop.MainActivity" on path: /data/app/com.badlogic.drop-2.apk
08-09 19:30:45.779: E/AndroidRuntime(747): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
08-09 19:30:45.779: E/AndroidRuntime(747): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-09 19:30:45.779: E/AndroidRuntime(747): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
08-09 19:30:45.779: E/AndroidRuntime(747): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
08-09 19:30:45.779: E/AndroidRuntime(747): ... 11 more
08-09 19:35:53.845: I/Process(747): Sending signal. PID: 747 SIG: 9
08-09 19:37:20.125: E/Trace(958): error opening trace file: No such file or directory (2)
08-09 19:37:20.225: W/dalvikvm(958): Unable to resolve superclass of Lcom/badlogic/drop/MainActivity; (20)
08-09 19:37:20.255: W/dalvikvm(958): Link of class 'Lcom/badlogic/drop/MainActivity;' failed
08-09 19:37:20.265: D/AndroidRuntime(958): Shutting down VM
08-09 19:37:20.265: W/dalvikvm(958): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
08-09 19:37:20.306: E/AndroidRuntime(958): FATAL EXCEPTION: main
08-09 19:37:20.306: E/AndroidRuntime(958): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.badlogic.drop/com.badlogic.drop.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.drop.MainActivity" on path: /data/app/com.badlogic.drop-2.apk
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.os.Looper.loop(Looper.java:137)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-09 19:37:20.306: E/AndroidRuntime(958): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 19:37:20.306: E/AndroidRuntime(958): at java.lang.reflect.Method.invoke(Method.java:511)
08-09 19:37:20.306: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-09 19:37:20.306: E/AndroidRuntime(958): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-09 19:37:20.306: E/AndroidRuntime(958): at dalvik.system.NativeStart.main(Native Method)
08-09 19:37:20.306: E/AndroidRuntime(958): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.badlogic.drop.MainActivity" on path: /data/app/com.badlogic.drop-2.apk
08-09 19:37:20.306: E/AndroidRuntime(958): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
08-09 19:37:20.306: E/AndroidRuntime(958): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-09 19:37:20.306: E/AndroidRuntime(958): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
08-09 19:37:20.306: E/AndroidRuntime(958): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
08-09 19:37:20.306: E/AndroidRuntime(958): ... 11 more
08-09 19:37:24.495: I/Process(958): Sending signal. PID: 958 SIG: 9
It seems you renamed your mainactivity class and didn't update the android manifest.

How to get rid of java.lang.OutOfMemoryError: thread creation failed in android?

I have used more than 15 Handlers in a timing being executed one gets over another on completion.I get java.lang.OutOfMemoryError: thread creation failed in the log and the app crashes,the code runs fine for the first time and gets crashes in the second time due to this issue how can I resolve this.Please help with this issue.Thanks.
MY log is
08-09 13:36:12.125: E/AndroidRuntime(1473): FATAL EXCEPTION: main
08-09 13:36:12.125: E/AndroidRuntime(1473): java.lang.OutOfMemoryError: thread creation failed
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.lang.VMThread.create(Native Method)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.lang.Thread.start(Thread.java:1232)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.util.Timer$TimerImpl.<init>(Timer.java:192)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.util.Timer.<init>(Timer.java:369)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.util.Timer.<init>(Timer.java:389)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.util.Timer.<init>(Timer.java:396)
08-09 13:36:12.125: E/AndroidRuntime(1473): at com.CarBuyCo.Slotter.rollerstopthree(Slotter.java:655)*
08-09 13:36:12.125: E/AndroidRuntime(1473): at com.CarBuyCo.Slotter$32.run(Slotter.java:593)*
08-09 13:36:12.125: E/AndroidRuntime(1473): at android.os.Handler.handleCallback(Handler.java:587)
08-09 13:36:12.125: E/AndroidRuntime(1473): at android.os.Handler.dispatchMessage(Handler.java:92)
08-09 13:36:12.125: E/AndroidRuntime(1473): at android.os.Looper.loop(Looper.java:130)
08-09 13:36:12.125: E/AndroidRuntime(1473): at android.app.ActivityThread.main(ActivityThread.java:3687)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 13:36:12.125: E/AndroidRuntime(1473): at java.lang.reflect.Method.invoke(Method.java:507)
08-09 13:36:12.125: E/AndroidRuntime(1473): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
08-09 13:36:12.125: E/AndroidRuntime(1473): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
08-09 13:36:12.125: E/AndroidRuntime(1473): at dalvik.system.NativeStart.main(Native Method)

Why does my program crash after I add Listview? Android

I am attempting to connect a listview lv to its id using
ListView lv = (ListView) findViewById(R.id.ImTrackingListView);
However whenever it hits this step my program crashes and sends it to the Source not found page.
Here is my code
public class ImTracking extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.imtrackinglayout);
ListView lv = (ListView) findViewById(R.id.imtrackinglistview);
I checked to make sure that there wasn't another id with the same name. Hopefully someone can help me find out why this is happening.
edit here is the xml (I changed the id to lowercase)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="#+id/imtrackinglistview"></ListView>
</LinearLayout>
Here is my logcat response
08-09 20:19:12.335: WARN/System.err(640): java.lang.ClassCastException: android.widget.TextView
08-09 20:19:12.354: WARN/System.err(640): at com.cellphone.ImTracking.onCreate(ImTracking.java:30)
08-09 20:19:12.366: WARN/System.err(640): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-09 20:19:12.366: WARN/System.err(640): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
08-09 20:19:12.374: WARN/System.err(640): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
08-09 20:19:12.374: WARN/System.err(640): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-09 20:19:12.374: WARN/System.err(640): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
08-09 20:19:12.384: WARN/System.err(640): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 20:19:12.384: WARN/System.err(640): at android.os.Looper.loop(Looper.java:123)
08-09 20:19:12.394: WARN/System.err(640): at android.app.ActivityThread.main(ActivityThread.java:3647)
08-09 20:19:12.394: WARN/System.err(640): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 20:19:12.394: WARN/System.err(640): at java.lang.reflect.Method.invoke(Method.java:507)
08-09 20:19:12.404: WARN/System.err(640): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-09 20:19:12.404: WARN/System.err(640): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-09 20:19:12.404: WARN/System.err(640): at dalvik.system.NativeStart.main(Native Method)
08-09 20:19:16.847: WARN/ActivityManager(60): Launch timeout has expired, giving up wake lock!
08-09 20:19:16.987: WARN/ActivityManager(60): Activity idle timeout for HistoryRecord{408bf110 com.cellphone/.ImTracking}
Try cleaning your project, for some reason the error contains a TextView.
There is a class cast exception in ImTracking file , post the error from log cat.Select E - and the last exception thrown would be in red , paste that.

Categories

Resources