Cannot run Android "Camera Preview" sample - android

The sample I'm referring to is: CameraPreview.
The program simply force closes upon start up. I've also tried other camera demos that have the same problem.
I'm trying to run the samples on my Nexus One and the emulator with the same problem on both. I'm not even sure if the emulator should be able to run them or not.
Based on LogCat, the error is:
06-08 16:39:10.483: ERROR/AndroidRuntime(6726): Uncaught handler: thread main exiting due to uncaught exception
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): java.lang.RuntimeException: Fail to connect to camera service
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.hardware.Camera.native_setup(Native Method)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.hardware.Camera.<init>(Camera.java:110)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.hardware.Camera.open(Camera.java:90)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at com.example.android.apis.graphics.Preview.surfaceCreated(CameraPreview.java:69)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.View.draw(View.java:6557)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.widget.FrameLayout.draw(FrameLayout.java:352)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.View.draw(View.java:6557)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.widget.FrameLayout.draw(FrameLayout.java:352)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewRoot.draw(ViewRoot.java:1349)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.os.Looper.loop(Looper.java:123)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at java.lang.reflect.Method.invoke(Method.java:521)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-08 16:39:10.494: ERROR/AndroidRuntime(6726): at dalvik.system.NativeStart.main(Native Method)
All I did to try out the sample was create a new Android 2.1update1 Project, named everything according to the supplied Java file, copied the Java file from the URL to the CameraPreview.java file, then run it. Am I supposed to do anything else?
Any help would be appreciated. Thanks in advance.

Add the following to your manifest, as children of the <manifest> element:
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />

Related

How to resolve java.lang.VerifyError in android

I am getting VerifyError for method calling of paticular class Utility ,first it was working properly and suddenly its started giving run time error, it is working fine with API lollipop and higher API , Here is my error logs.
06-08 12:25:07.655: E/AndroidRuntime(18117): FATAL EXCEPTION: main
06-08 12:25:07.655: E/AndroidRuntime(18117): java.lang.VerifyError: com/package/projectname/utility/Utility
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.package.projectname.AppDelegate.onCreate(AppDelegate.java:36)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4575)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.access$1400(ActivityThread.java:153)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.os.Looper.loop(Looper.java:176)
06-08 12:25:07.655: E/AndroidRuntime(18117): at android.app.ActivityThread.main(ActivityThread.java:5302)
06-08 12:25:07.655: E/AndroidRuntime(18117): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:25:07.655: E/AndroidRuntime(18117): at java.lang.reflect.Method.invoke(Method.java:511)
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-08 12:25:07.655: E/AndroidRuntime(18117): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-08 12:25:07.655: E/AndroidRuntime(18117): at dalvik.system.NativeStart.main(Native Method)
I solved this error by placing gms library separately:
Before I have used :
compile 'com.google.android.gms:play-services:8.1.0'
That above one line will take care of GCM and all google related libaries.But this one line cause a verifier error.On top of the verifier error you can see some gms related log.
After that I have added separately like this to fix this issue :
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-base:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile "com.google.android.gms:play-services-gcm:8.1.0' // for gcm push notification
and also Check this

How to solve "Out of memory" during image processing on Imagine SDK android [duplicate]

This question already has answers here:
Strange OutOfMemory issue while loading an image to a Bitmap object
(44 answers)
Closed 7 years ago.
as i am implementing both OCR and Imagine SDK for our app, i need your help to solve this problem.
i have a method like below.
public void ImageProcessing(View v) {
try {
MIContext _miContext = MIContext.getInstance();
_miContext.clearAll();
Uri _imageUri = Uri.fromFile(GetImageFile("form.jpg")); // GetImageFile() will return a file
ImageOperation _imageOperation = ImageOperation.AUTO_ENHANCE;
OperationController _operationController = _imageOperation.getController();
_miContext.loadSourceImage( _imageUri, this );
final FineOperation fineOperation = _operationController.createOperation();
_miContext.run( fineOperation );
} catch (Exception e) {
Log.v("mango", e.getMessage());
}
}
when i execute it. it returns "Out of memory: Heap Size=7943KB, Allocated=4113KB, Bitmap Size=24888KB, Limit=32768KB"
below is my logcat output.
06-08 12:24:44.561: V/mango(16037): onCreate()
06-08 12:24:44.561: V/mango(16037): starting......
06-08 12:24:44.561: D/dalvikvm(16037): Trying to load lib /data/data/com.abbyy.sample/lib/libMobileImagingEngine.so 0x4051bfd8
06-08 12:24:44.881: D/dalvikvm(16037): Added shared lib /data/data/com.abbyy.sample/lib/libMobileImagingEngine.so 0x4051bfd8
06-08 12:24:44.881: V/mango(16037): MILicenser.getVersionInfo(): 1.2.1.15
06-08 12:24:44.951: V/mango(16037): MILicenser.setLicense() succeeded. Current state:
06-08 12:24:44.951: V/mango(16037): License: Infinite.
06-08 12:24:44.951: V/mango(16037): General availability: Enabled with results scrambling.
06-08 12:24:44.951: V/mango(16037): Allowed platforms: All.
06-08 12:24:44.951: V/mango(16037): Common processing available: Yes.
06-08 12:24:44.951: V/mango(16037): Defect detecting available: Yes.
06-08 12:24:44.951: V/mango(16037): Server side processing available: No.??
06-08 12:24:45.401: D/dalvikvm(16037): Trying to load lib /data/data/com.abbyy.sample/lib/libMobileOcrEngine.so 0x4051bfd8
06-08 12:24:45.892: D/dalvikvm(16037): Added shared lib /data/data/com.abbyy.sample/lib/libMobileOcrEngine.so 0x4051bfd8
06-08 12:24:46.032: D/dalvikvm(16037): GC_CONCURRENT freed 173K, 45% free 3109K/5639K, external 0K/0K, paused 4ms+13ms
06-08 12:24:46.392: D/ATRecorder(16037): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader#40582d68
06-08 12:24:46.402: D/WindowManagerImpl(16037): addView, new view, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView#4055b6e8
06-08 12:26:46.029: D/View(16037): onTouchEvent: viewFlags: 0x18004001
06-08 12:26:46.029: D/View(16037): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false
06-08 12:26:57.210: D/dalvikvm(16037): GC_EXTERNAL_ALLOC freed 184K, 44% free 3248K/5767K, external 0K/0K, paused 31ms
06-08 12:26:58.071: D/ATRecorder(16037): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader#4059fd80
06-08 12:26:58.071: D/WindowManagerImpl(16037): addView, new view, mViews[1]: com.android.internal.policy.impl.PhoneWindow$DecorView#4059cad0
06-08 12:26:58.311: D/WindowManagerImpl(16037): finishRemoveViewLocked, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView#4055b6e8
06-08 12:26:59.632: D/View(16037): onTouchEvent: viewFlags: 0x18004001
06-08 12:26:59.632: D/View(16037): onTouchEvent: isFocusable: true, isFocusableInTouchMode: false, isFocused: false; focusTaken: false
06-08 12:26:59.672: D/dalvikvm(16037): GC_EXPLICIT freed 103K, 45% free 3189K/5767K, external 24888K/26936K, paused 27ms
06-08 12:26:59.763: I/dalvikvm-heap(16037): Clamp target GC heap from 32.598MB to 32.000MB
06-08 12:26:59.763: D/dalvikvm(16037): GC_FOR_MALLOC freed 552K, 44% free 4145K/7367K, external 24888K/26936K, paused 17ms
06-08 12:26:59.763: I/dalvikvm-heap(16037): Forcing collection of SoftReferences for 1966096-byte allocation
06-08 12:26:59.773: I/dalvikvm-heap(16037): Clamp target GC heap from 32.566MB to 32.000MB
06-08 12:26:59.773: D/dalvikvm(16037): GC_FOR_MALLOC freed 32K, 45% free 4113K/7367K, external 24888K/26936K, paused 18ms
06-08 12:26:59.783: E/dalvikvm-heap(16037): Out of memory on a 1966096-byte allocation.
06-08 12:26:59.783: I/dalvikvm(16037): "main" prio=5 tid=1 RUNNABLE
06-08 12:26:59.783: I/dalvikvm(16037): | group="main" sCount=0 dsCount=0 obj=0x400275d8 self=0xd050
06-08 12:26:59.783: I/dalvikvm(16037): | sysTid=16037 nice=0 sched=0/0 cgrp=default handle=-1345002112
06-08 12:26:59.783: I/dalvikvm(16037): | schedstat=( 1244079605 798675516 1219 )
06-08 12:26:59.783: I/dalvikvm(16037): at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:~91)
06-08 12:26:59.783: I/dalvikvm(16037): at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:216)
06-08 12:26:59.783: I/dalvikvm(16037): at com.abbyy.mobile.imaging.MIExporter.importJPEG(MIExporter.java:102)
06-08 12:26:59.783: I/dalvikvm(16037): at com.abbyy.sample.MIContext.loadSourceImage(MIContext.java:114)
06-08 12:26:59.783: I/dalvikvm(16037): at com.abbyy.sample.ScanTheForm.ImageProcessing(ScanTheForm.java:71)
06-08 12:26:59.783: I/dalvikvm(16037): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:26:59.783: I/dalvikvm(16037): at java.lang.reflect.Method.invoke(Method.java:507)
06-08 12:26:59.783: I/dalvikvm(16037): at android.view.View$1.onClick(View.java:2187)
06-08 12:26:59.793: I/dalvikvm(16037): at android.view.View.performClick(View.java:2533)
06-08 12:26:59.793: I/dalvikvm(16037): at android.view.View$PerformClick.run(View.java:9320)
06-08 12:26:59.793: I/dalvikvm(16037): at android.os.Handler.handleCallback(Handler.java:587)
06-08 12:26:59.793: I/dalvikvm(16037): at android.os.Handler.dispatchMessage(Handler.java:92)
06-08 12:26:59.793: I/dalvikvm(16037): at android.os.Looper.loop(Looper.java:150)
06-08 12:26:59.793: I/dalvikvm(16037): at android.app.ActivityThread.main(ActivityThread.java:4385)
06-08 12:26:59.793: I/dalvikvm(16037): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:26:59.793: I/dalvikvm(16037): at java.lang.reflect.Method.invoke(Method.java:507)
06-08 12:26:59.793: I/dalvikvm(16037): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
06-08 12:26:59.793: I/dalvikvm(16037): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
06-08 12:26:59.793: I/dalvikvm(16037): at dalvik.system.NativeStart.main(Native Method)
06-08 12:26:59.793: E/dalvikvm(16037): Out of memory: Heap Size=7943KB, Allocated=4113KB, Bitmap Size=24888KB, Limit=32768KB
06-08 12:26:59.793: E/dalvikvm(16037): Extra info: Footprint=7367KB, Allowed Footprint=7943KB, Trimmed=480KB
06-08 12:26:59.793: D/AndroidRuntime(16037): Shutting down VM
06-08 12:26:59.793: W/dalvikvm(16037): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
06-08 12:26:59.803: E/AndroidRuntime(16037): FATAL EXCEPTION: main
06-08 12:26:59.803: E/AndroidRuntime(16037): java.lang.IllegalStateException: Could not execute method of the activity
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.view.View$1.onClick(View.java:2192)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.view.View.performClick(View.java:2533)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.view.View$PerformClick.run(View.java:9320)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.os.Handler.handleCallback(Handler.java:587)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.os.Handler.dispatchMessage(Handler.java:92)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.os.Looper.loop(Looper.java:150)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.app.ActivityThread.main(ActivityThread.java:4385)
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.lang.reflect.Method.invoke(Method.java:507)
06-08 12:26:59.803: E/AndroidRuntime(16037): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
06-08 12:26:59.803: E/AndroidRuntime(16037): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
06-08 12:26:59.803: E/AndroidRuntime(16037): at dalvik.system.NativeStart.main(Native Method)
06-08 12:26:59.803: E/AndroidRuntime(16037): Caused by: java.lang.reflect.InvocationTargetException
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.lang.reflect.Method.invoke(Method.java:507)
06-08 12:26:59.803: E/AndroidRuntime(16037): at android.view.View$1.onClick(View.java:2187)
06-08 12:26:59.803: E/AndroidRuntime(16037): ... 11 more
06-08 12:26:59.803: E/AndroidRuntime(16037): Caused by: java.lang.OutOfMemoryError: (Heap Size=7943KB, Allocated=4113KB, Bitmap Size=24888KB)
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
06-08 12:26:59.803: E/AndroidRuntime(16037): at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:216)
06-08 12:26:59.803: E/AndroidRuntime(16037): at com.abbyy.mobile.imaging.MIExporter.importJPEG(MIExporter.java:102)
06-08 12:26:59.803: E/AndroidRuntime(16037): at com.abbyy.sample.MIContext.loadSourceImage(MIContext.java:114)
06-08 12:26:59.803: E/AndroidRuntime(16037): at com.abbyy.sample.ScanTheForm.ImageProcessing(ScanTheForm.java:71)
06-08 12:26:59.803: E/AndroidRuntime(16037): ... 14 more
am i doing something wrong ? Hemp help me guys
You can try increasing the allocated memory to your application. In android Every application gets a chunk of memory allocated. but in case of image processing application it is most likely to fall short of that memory.
Also try manually cleaning up the memory in your app. The android garbage collector usually have bitmap image memory leakages.
you can get a good read up on this via following link
bitmap memory managment
Use this in your application tag of Manifest file ..
android:largeHeap="true"

Call Web Service in Android application

I want to call .net web service into Android application. For that I am using running web service available on net called
"www.w3schools.com/webservices/tempconvert.asmx"
It's running successfully with browser, but when I call it in my Android application it gives me error in my tab device. The log cat info is shown below:
06-08 17:27:16.351: E/dalvikvm(5767): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.example.wscallingapk.WS_MainActivity.onCreate
06-08 17:27:22.612: E/AndroidRuntime(5767): FATAL EXCEPTION: main
06-08 17:27:22.612: E/AndroidRuntime(5767): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.example.wscallingapk.WS_MainActivity.onCreate(WS_MainActivity.java:37)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.os.Handler.dispatchMessage(Handler.java:99)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.os.Looper.loop(Looper.java:123)
06-08 17:27:22.612: E/AndroidRuntime(5767): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invokeNative(Native Method)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767): at java.lang.reflect.Method.invoke(Method.java:521)
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
06-08 17:27:22.612: E/AndroidRuntime(5767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
06-08 17:27:22.612: E/AndroidRuntime(5767): at dalvik.system.NativeStart.main(Native Method)
ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar
Download this library from this Link
and put it into your lib folder of your project.

java.lang.OutOfMemoryError bitmap create?

I just got this stack trace from the marketplace error reporting and have no idea where to being to track the problem down, any help appreciated.
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:463)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:326)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.Resources.getDrawable(Resources.java:581)
at com.android.internal.view.menu.MenuItemImpl.getIcon(MenuItemImpl.java:440)
at com.android.internal.view.menu.IconMenuItemView.initialize(IconMenuItemView.java:109)
at com.android.internal.view.menu.MenuItemImpl.createItemView(MenuItemImpl.java:594)
at com.android.internal.view.menu.MenuItemImpl.getItemView(MenuItemImpl.java:577)
at com.android.internal.view.menu.IconMenuView.updateChildren(IconMenuView.java:351)
at com.android.internal.view.menu.IconMenuView.initialize(IconMenuView.java:333)
at com.android.internal.view.menu.MenuBuilder$MenuType.getMenuView(MenuBuilder.java:199)
at com.android.internal.view.menu.MenuBuilder.getMenuView(MenuBuilder.java:323)
at com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:858)
at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:435)
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:621)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1339)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.widget.TabHost.dispatchKeyEvent(TabHost.java:278)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:789)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1687)
at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1120)
at android.app.Activity.dispatchKeyEvent(Activity.java:2073)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1663)
at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3647)
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'm getting the same error on an application I've developed for Android 2.1 and Android 2.2 but run on Android 4.0.1 ICS. The same app would run on Android 2.1 but cause a crash with the above error on ICS. If you're drawing something relatively big to the size of the screen, consider checking from that place.

NullPointerException app loading

When my app loads the following error comes up on some devices. It refers to none of my source files at all! How do I go about fixing this one?
java.lang.NullPointerException
at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:42)
at com.google.android.maps.MapView.onDraw(MapView.java:494)
at android.view.View.draw(View.java:6739)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
at android.view.ViewRoot.draw(ViewRoot.java:1422)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
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)
As mentioned here: Marking Current Location on Map, Android and here http://code.google.com/p/android/issues/detail?id=2035, you may need to call overlays.populate(); method in your code.

Categories

Resources