YouTube player for android crashes on ads playback - android

We use Android Youtube API in out application. Lately I noticed that application crashes every time I try to play a video with enabled ads.
I'm able to reproduce it using their sample applications. I've tried SimplePlayerFragment and SimplePlayerView examples. Both crash when I try to cue the http://www.youtube.com/watch?v=QudbrUcVPxk video (this is just an example, other videos with ads are failing too).
Here is LogCat output:
10-26 19:10:49.074: E/AndroidRuntime(21637): FATAL EXCEPTION: main
10-26 19:10:49.074: E/AndroidRuntime(21637):
java.lang.IllegalStateException: android.os.DeadObjectException 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:236)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.SurfaceView.updateWindow(SurfaceView.java:555) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:232)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.View.dispatchDetachedFromWindow(View.java:12156) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2565)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2565)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeViewInternal(ViewGroup.java:3785) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeViewInternal(ViewGroup.java:3758) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeView(ViewGroup.java:3690) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.YouTubePlayerView$1.b(Unknown
Source) 10-26 19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.internal.r.h(Unknown Source) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.internal.r$e.onServiceDisconnected(Unknown
Source) 10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1111)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1125)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.os.Handler.handleCallback(Handler.java:730) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.os.Handler.dispatchMessage(Handler.java:92) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.os.Looper.loop(Looper.java:137) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
android.app.ActivityThread.main(ActivityThread.java:5103) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
java.lang.reflect.Method.invokeNative(Native Method) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
java.lang.reflect.Method.invoke(Method.java:525) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
dalvik.system.NativeStart.main(Native Method) 10-26 19:10:49.074:
E/AndroidRuntime(21637): Caused by: android.os.DeadObjectException
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.os.BinderProxy.transact(Native Method) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.b.a.be.a(SourceFile:221) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:233)
10-26 19:10:49.074: E/AndroidRuntime(21637): ... 22 more
I'd appreciate any ideas on how to solve the problem.
UPD:
Thanks to #septagon, found another related LogCat message:
10-27 16:58:51.763: D/YouTubeAndroidPlayerAPI(25196):
apps.youtube.core.client.DefaultAdStatsClient.a:485 Pinging
__AWCl-JGAkAHIAQWpAn4krwpwE7A-4AIAqAMBmAQFqgSwAU_QADdeVEnDazwBrSnaYs3R1HBqy45Cu537TEJ3YTBlvSni0sRdoz7KdLcSM8GN-htn40LlHEa78Q0Wc-Hrk04QcefoGDWqXcyn7fC6U9J6CfOz_J6n509CB7hJfQX2xrj2YTLwO2_AeK-bj9k3KWULoKQv_ZBYw5PfzGYPi2xuSOmQuuFoYcr0atVp-oLKiFDMrNiGhAsjaCbg8jlG43cEZZZ-VSGq1f9Oz1b-XQKw4AQBiAXhiftBkgUGCAMQARgBkgUGCAQQBRgKkgUGCAQQARgBkgUGCAYQARgBkgUECAYYA5AGAaAGHNgGAoAHuaXfLA&sigh=PjCzMkHYDKo&cid=5Gi9PCMcr3WKhFJWqILtjrdq&template_id=213">http://pubads.g.doubleclick.net/pagead/adview?ai=Cr6PgkatsUt7LE8GpmgXc3oHwBbGx9t8DsZHlu3Kx0vmLARABIOP7kwNQ4vr5ivj___AWCl-JGAkAHIAQWpAn4krwpwE7A-4AIAqAMBmAQFqgSwAU_QADdeVEnDazwBrSnaYs3R1HBqy45Cu537TEJ3YTBlvSni0sRdoz7KdLcSM8GN-htn40LlHEa78Q0Wc-Hrk04QcefoGDWqXcyn7fC6U9J6CfOz_J6n509CB7hJfQX2xrj2YTLwO2_AeK-bj9k3KWULoKQv_ZBYw5PfzGYPi2xuSOmQuuFoYcr0atVp-oLKiFDMrNiGhAsjaCbg8jlG43cEZZZ-VSGq1f9Oz1b-XQKw4AQBiAXhiftBkgUGCAMQARgBkgUGCAQQBRgKkgUGCAQQARgBkgUGCAYQARgBkgUECAYYA5AGAaAGHNgGAoAHuaXfLA&sigh=PjCzMkHYDKo&cid=5Gi9PCMcr3WKhFJWqILtjrdq&template_id=213
10-27 16:58:51.763: D/AndroidRuntime(25196): Shutting down VM 10-27
16:58:51.763: W/dalvikvm(25196): threadid=1: thread exiting with
uncaught exception (group=0x4158d700) 10-27 16:58:51.773:
E/AndroidRuntime(25196): FATAL EXCEPTION: main 10-27 16:58:51.773:
E/AndroidRuntime(25196): java.lang.NullPointerException 10-27
16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.AdStatsMacros.a(SourceFile:185)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:481)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:467)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:461)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.h(SourceFile:320)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.StatsTracker.g(SourceFile:409)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.an.handleMessage(SourceFile:1615)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
android.os.Handler.dispatchMessage(Handler.java:95) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
android.os.Looper.loop(Looper.java:137) 10-27 16:58:51.773:
E/AndroidRuntime(25196): at
android.app.ActivityThread.main(ActivityThread.java:5103) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
java.lang.reflect.Method.invokeNative(Native Method) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
java.lang.reflect.Method.invoke(Method.java:525) 10-27 16:58:51.773:
E/AndroidRuntime(25196): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
dalvik.system.NativeStart.main(Native Method)

There is bug filed in public issue tracker.
You can track the progress from there.
Bug is also filed internally.

I encounter the same problem too using my Galaxy S4 with the latest version of youtube.
I tried it on my Gnex which does not have the most recent version of youtube and of course everything works fine. seems like the last update made a mess.
Is there any other way to get their attention? is there a way to remove the latest update (just for now, to continue with the development) ?
And for a different topic, have you tried the getCurrentTimeMillis method more than once a second? do you get different time stamps or just the same when you call it more than once a second (say once every 100ms) ?
Thanks,
Roy

Check your unfiltered logcat for a NullPointerException coming from com.google.android.apps.youtube.core.player.AdStatsMacros. If you can find such an error, you're probably having the same problem as I and this question are experiencing.
Youtube Player API android crashes on playback on some devices
I can confirm that this error has been introduced within the last seventy-two hours and caused a flawlessly-working app to crash whenever an ad tries to play. The error appears to be coming from deep inside the YouTube Player API jar. Nothing seems to be confirmed yet, but it looks like YouTube is trying something new on their API back-end and having some troubles.

Related

Vuforia jPCT integration and build jni

I getting following error while running imagetarge vuforia jPCT project
W/dalvikvm(3469): threadid=1: thread exiting with uncaught exception (group=0xa4c4e648)
E/AndroidRuntime(3469): FATAL EXCEPTION: main
E/AndroidRuntime(3469): java.lang.UnsatisfiedLinkError: Native method not found: com.qualcomm.ar.pl.CameraPreview.newFrameAvailable:(IIII[B)V
E/AndroidRuntime(3469): at com.qualcomm.ar.pl.CameraPreview.newFrameAvailable(Native Method)
E/AndroidRuntime(3469): at com.qualcomm.ar.pl.CameraPreview.onPreviewFrame(CameraPreview.java:805)
E/AndroidRuntime(3469): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:791)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(3469): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(3469): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3469): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(3469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(3469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(3469): at dalvik.system.NativeStart.main(Native Method)
I read all vuforia blog and google search but not able to solve problem
Please help me...
Used latest vaforia.jar to solve problem
Download latest sdk from https://developer.vuforia.com/resources/sdk/android

Eclipse android LogCat: GCMRegistrar: saving regId on app error

I can not figure this out, in one of my test apps I get an error when closing the app.
In LogCat I see the handleRegistration long code as ok, in blue text but some lines futher after saving regId on app the registration code is in red text.
Someone know why?
In another app, at the same emulator, it does not happen but I can not find the solution.
EDIT
You are right, sorry, this is LogCat output:
10-26 12:22:11.383: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:11.539: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:11.644: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:11.718: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:11.873: D/GCMRegistrar(754): resetting backoff for nl.easy.gcmnotification
10-26 12:22:11.883: V/GCMRegistrar(754): Registering app nl.easy.gcmnotification of senders 182xxxxxx601
10-26 12:22:12.153: I/dalvikvm(754): threadid=3: reacting to signal 3
10-26 12:22:12.163: I/dalvikvm(754): Wrote stack traces to '/data/anr/traces.txt'
10-26 12:22:12.445: D/gralloc_goldfish(754): Emulator without GPU emulation detected.
10-26 12:22:13.843: V/GCMBroadcastReceiver(754): onReceive:
com.google.android.c2dm.intent.REGISTRATION
10-26 12:22:13.843: V/GCMBroadcastReceiver(754): GCM IntentService class: nl.easy.gcmnotification.GCMIntentService
10-26 12:22:13.853: V/GCMBaseIntentService(754): Acquiring wakelock
10-26 12:22:13.864: V/GCMBaseIntentService(754): Intent service name: GCMIntentService-182537982601-1
10-26 12:22:13.953: E/GCMRegistrar(754): internal error: retry receiver class not set yet
10-26 12:22:13.953: V/GCMRegistrar(754): Registering receiver
10-26 12:22:13.953: D/GCMBaseIntentService(754): handleRegistration: registrationId = APAxxxxxx8Kg, error = null, unregistered = null (IN COLOR BLUE)
10-26 12:22:13.953: D/GCMRegistrar(754): resetting backoff for nl.easy.gcmnotification
10-26 12:22:13.964: V/GCMRegistrar(754): Saving regId on app version 1
10-26 12:22:13.973: E/(754): registration id : APAxxxxxx8Kg (IN COLOR RED)
10-26 12:22:13.973: V/GCMBaseIntentService(754): Releasing wakelock
(WHEN SHUTTING DOWN APP)
10-26 12:22:35.033: V/GCMRegistrar(754): Unregistering receiver
10-26 12:22:35.033: D/AndroidRuntime(754): Shutting down VM
10-26 12:22:35.033: W/dalvikvm(754): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
10-26 12:22:35.155: E/AndroidRuntime(754): FATAL EXCEPTION: main
10-26 12:22:35.155: E/AndroidRuntime(754): java.lang.RuntimeException: Unable to destroy activity {nl.easy.gcmnotification/nl.easy.gcmnotification.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: com.google.android.gcm.GCMBroadcastReceiver#412bc5c0
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3112)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3130)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread.access$1200(ActivityThread.java:123)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1180)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.os.Looper.loop(Looper.java:137)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-26 12:22:35.155: E/AndroidRuntime(754): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 12:22:35.155: E/AndroidRuntime(754): at java.lang.reflect.Method.invoke(Method.java:511)
10-26 12:22:35.155: E/AndroidRuntime(754): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-26 12:22:35.155: E/AndroidRuntime(754): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-26 12:22:35.155: E/AndroidRuntime(754): at dalvik.system.NativeStart.main(Native Method)
10-26 12:22:35.155: E/AndroidRuntime(754): Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.google.android.gcm.GCMBroadcastReceiver#412bc5c0
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:628)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1066)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:354)
10-26 12:22:35.155: E/AndroidRuntime(754): at com.google.android.gcm.GCMRegistrar.onDestroy(GCMRegistrar.java:266)
10-26 12:22:35.155: E/AndroidRuntime(754): at nl.easy.gcmnotification.MainActivity.onDestroy(MainActivity.java:49)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.Activity.performDestroy(Activity.java:4629)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1079)
10-26 12:22:35.155: E/AndroidRuntime(754): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3099)
10-26 12:22:35.155: E/AndroidRuntime(754): ... 11 more
Can you post the code used for destroying the activity ?
I think your problem is the same as this one :
GCMRegistrar.onDestroy(context) crashing, Receiver not registered
Another potential issue : Did you declare the service in your manifest ?
The problem is fixed by restarting eclipse and clean/rebuild the project... Strange but true!

Unable to open stack trace file '/data/anr/jbt/jbt.907.tmp': No such file or directory?

My programe runs but i get the above mentioned eroor in logcat what is the reason i could not no getting so help me in this regard. I am providing my stack trace. If any body knows why this error comes please let me know
10-26 06:55:55.248: W/System.err(981): at android.app.ActivityThread.main(ActivityThread.java:3814)
10-26 06:55:55.248: W/System.err(981): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 06:55:55.248: W/System.err(981): at java.lang.reflect.Method.invoke(Method.java:538)
10-26 06:55:55.248: W/System.err(981): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
10-26 06:55:55.248: W/System.err(981): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
10-26 06:55:55.248: W/System.err(981): at dalvik.system.NativeStart.main(Native Method)
10-26 06:55:55.248: W/System.err(981): Caused by: java.lang.NullPointerException
10-26 06:55:55.248: W/System.err(981): at com.simsys.securex.PolicyReceiver.onReceive(PolicyReceiver.java:821)
10-26 06:55:55.248: W/System.err(981): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1888)
10-26 06:55:55.248: W/System.err(981): ... 10 more
10-26 06:56:05.529: I/dalvikvm(981): threadid=4: reacting to signal 3
10-26 06:56:05.529: D/dalvikvm(981): SigQuit + : 0
10-26 06:56:05.533: I/dalvikvm(981): Wrote stack traces to '/data/anr/traces.txt'
10-26 06:56:05.543: E/dalvikvm(981): Unable to open stack trace file '/data/anr/jbt/jbt.981.tmp': No such file or directory
10-26 06:56:05.543: D/dalvikvm(981): SigQuit - : 0
10-26 06:59:19.745: I/dalvikvm(1043): threadid=4: reacting to signal 3
10-26 06:59:19.745: D/dalvikvm(1043): SigQuit + : 0
10-26 06:59:19.757: I/dalvikvm(1043): Wrote stack traces to '/data/anr/traces.txt'
10-26 06:59:19.765: E/dalvikvm(1043): Unable to open stack trace file '/data/anr/jbt/jbt.1043.tmp': No such file or directory
10-26 06:59:19.765: D/dalvikvm(1043): SigQuit - : 0
10-26 06:59:32.834: D/AndroidRuntime(1135): Shutting down VM
10-26 06:59:32.834: W/dalvikvm(1135): threadid=1: thread exiting with uncaught exception (group=0x4001c648)
10-26 06:59:32.838: W/System.err(1135): java.lang.RuntimeException: Unable to start receiver com.simsys.securex.PolicyReceiver: java.lang.NullPointerException
10-26 06:59:32.839: W/System.err(1135): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1899)
10-26 06:59:32.839: W/System.err(1135): at android.app.ActivityThread.access$2400(ActivityThread.java:155)
10-26 06:59:32.839: W/System.err(1135): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1043)
10-26 06:59:32.839: W/System.err(1135): at android.os.Handler.dispatchMessage(Handler.java:130)
10-26 06:59:32.840: W/System.err(1135): at android.os.Looper.loop(SourceFile:351)
10-26 06:59:32.840: W/System.err(1135): at android.app.ActivityThread.main(ActivityThread.java:3814)
10-26 06:59:32.840: W/System.err(1135): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 06:59:32.840: W/System.err(1135): at java.lang.reflect.Method.invoke(Method.java:538)
10-26 06:59:32.840: W/System.err(1135): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
10-26 06:59:32.841: W/System.err(1135): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
10-26 06:59:32.841: W/System.err(1135): at dalvik.system.NativeStart.main(Native Method)
10-26 06:59:32.841: W/System.err(1135): Caused by: java.lang.NullPointerException
10-26 06:59:32.841: W/System.err(1135): at com.simsys.securex.PolicyReceiver.onReceive(PolicyReceiver.java:821)
10-26 06:59:32.841: W/System.err(1135): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1888)
10-26 06:59:32.842: W/System.err(1135): ... 10 more
10-26 06:59:43.649: I/dalvikvm(1135): threadid=4: reacting to signal 3
10-26 06:59:43.649: D/dalvikvm(1135): SigQuit + : 0
10-26 06:59:43.653: I/dalvikvm(1135): Wrote stack traces to '/data/anr/traces.txt'
10-26 06:59:43.664: E/dalvikvm(1135): Unable to open stack trace file '/data/anr/jbt/jbt.1135.tmp': No such file or directory
10-26 06:59:43.664: D/dalvikvm(1135): SigQuit - : 0
10-26 07:01:01.606: I/dalvikvm(1184): threadid=4: reacting to signal 3
10-26 07:01:01.606: D/dalvikvm(1184): SigQuit + : 0
10-26 07:01:01.611: I/dalvikvm(1184): Wrote stack traces to '/data/anr/traces.txt'
10-26 07:01:01.613: E/dalvikvm(1184): Unable to open stack trace file '/data/anr/jbt/jbt.1184.tmp': No such file or directory
10-26 07:01:01.613: D/dalvikvm(1184): SigQuit - : 0
There is an attempt to access some null object at line 821 of your PolicyReceiver.java file.
Regarding the Unable to open stack trace file error messages, they seem to be a common problem of some Android system builds. The system tries but fails to write some information that could help you debug your actual bug. This is not relevant for you because you already have this information in the log you see with logcat.

opening google map in a tab in android not working

I'm trying to open a google map application I did in a tab but its not working, it keep getting the force close message when I run it. I created the main activity file[TabtestingActivity] which creates the tabs [HelloGoogleActivity class contains the map code and it works fine without tabs]
public class TabstestingActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
intent = new Intent().setClass(this, HelloGoogleActivity.class);
spec = tabHost.newTabSpec("tabOne");
spec.setContent(intent);
spec.setIndicator("Tab One",res.getDrawable(R.drawable.tabselect));
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}
if I create a class which only has a text in it it works fine with tabs but when I add the map class it stops working.
This is my main.xml:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="my key"
android:layout_weight="1"/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
is there any problem with my main.xml?
This is the logcat:
10-26 00:47:10.207: ERROR/AndroidRuntime(303): FATAL EXCEPTION: main
10-26 00:47:10.207: ERROR/AndroidRuntime(303): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tabtest/com.example.tabtest.TabstestingActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class com.google.android.maps.MapView
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.os.Handler.dispatchMessage(Handler.java:99)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.os.Looper.loop(Looper.java:123)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at java.lang.reflect.Method.invokeNative(Native Method)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at java.lang.reflect.Method.invoke(Method.java:521)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at dalvik.system.NativeStart.main(Native Method)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class com.google.android.maps.MapView
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.Activity.setContentView(Activity.java:1647)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.example.tabtest.TabstestingActivity.onCreate(TabstestingActivity.java:15)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): ... 11 more
10-26 00:47:10.207: ERROR/AndroidRuntime(303): Caused by: java.lang.reflect.InvocationTargetException
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.google.android.maps.MapView.<init>(MapView.java:238)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at java.lang.reflect.Constructor.constructNative(Native Method)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): ... 22 more
10-26 00:47:10.207: ERROR/AndroidRuntime(303): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.google.android.maps.MapView.<init>(MapView.java:282)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): at com.google.android.maps.MapView.<init>(MapView.java:255)
10-26 00:47:10.207: ERROR/AndroidRuntime(303): ... 26 more
The trace is pretty clear,
"10-26 00:47:10.207: ERROR/AndroidRuntime(303): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity."
You can't use the MapView outside of a MapActivity.

Difficulty in integrating a separate project into other project

I have a project which has gui consisting of three buttons.Now one of these button is to be associated with other activity.I have developed the code for this activity separately and tested it but now when I'm integrating this in my main gui project it is showing errors.(Clicking on button will get me the current location on google maps).
Here is my log cat :
10-27 01:45:44.533: E/ActivityThread(357): Failed to find provider info for com.google.settings
10-27 01:45:44.563: E/ActivityThread(357): Failed to find provider info for com.google.settings
10-27 01:45:44.633: D/AndroidRuntime(357): Shutting down VM
10-27 01:45:44.633: W/dalvikvm(357): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
10-27 01:45:44.643: E/AndroidRuntime(357): Uncaught handler: thread main exiting due to uncaught exception
10-27 01:45:44.653: E/AndroidRuntime(357): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gui/com.example.gui.LocationActivity}: java.lang.NullPointerException
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.os.Looper.loop(Looper.java:123)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread.main(ActivityThread.java:4363)
10-27 01:45:44.653: E/AndroidRuntime(357): at java.lang.reflect.Method.invokeNative(Native Method)
10-27 01:45:44.653: E/AndroidRuntime(357): at java.lang.reflect.Method.invoke(Method.java:521)
10-27 01:45:44.653: E/AndroidRuntime(357): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-27 01:45:44.653: E/AndroidRuntime(357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-27 01:45:44.653: E/AndroidRuntime(357): at dalvik.system.NativeStart.main(Native Method)
10-27 01:45:44.653: E/AndroidRuntime(357): Caused by: java.lang.NullPointerException
10-27 01:45:44.653: E/AndroidRuntime(357): at com.example.gui.LocationActivity.onCreate(LocationActivity.java:50)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-27 01:45:44.653: E/AndroidRuntime(357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
10-27 01:45:44.653: E/AndroidRuntime(357): ... 11 more
10-27 01:45:44.693: I/dalvikvm(357): threadid=7: reacting to signal 3
10-27 01:45:44.693: E/dalvikvm(357): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
Can anyone help me to solve this ?
You are getting the error message because at line 50 when you call
map.setBuiltInZoomControls(true);
your map variable is null. Please post your main.xml file as that is where your onCreate method is looking for views when you call findViewById since you called
setContentView(R.layout.main);

Categories

Resources