I have an app that deals with images, it works fine with some devices ex. HTC ONE X, and others dont ex. GALAXY NOTE, the list is big IDK the problem exatcly cuz it works in some, and it dont in others. also it doesnt work on the emulator the default one but a small one it does work
this is the logcat I get
08-15 18:30:39.070: I/dalvikvm-heap(334): Clamp target GC heap from 25.723MB to 24.000MB
08-15 18:30:39.090: D/dalvikvm(334): GC_FOR_MALLOC freed <1K, 51% free 2672K/5379K, external 19015K/19657K, paused 38ms
08-15 18:30:39.370: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed <1K, 51% free 2672K/5379K, external 19015K/19657K, paused 45ms
08-15 18:30:39.400: E/dalvikvm-heap(334): 810000-byte external allocation too large for this process.
08-15 18:30:39.510: I/dalvikvm-heap(334): Clamp target GC heap from 25.724MB to 24.000MB
08-15 18:30:39.510: E/GraphicsJNI(334): VM won't let us allocate 810000 bytes
08-15 18:30:39.510: D/dalvikvm(334): GC_FOR_MALLOC freed 0K, 51% free 2672K/5379K, external 19015K/19657K, paused 36ms
08-15 18:30:39.532: D/AndroidRuntime(334): Shutting down VM
08-15 18:30:39.532: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-15 18:30:39.600: E/AndroidRuntime(334): FATAL EXCEPTION: main
08-15 18:30:39.600: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{app.com.android.editor/app.com.android.editor.Option}: android.view.InflateException: Binary XML file line #317: Error inflating class <unknown>
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-15 18:30:39.600: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: android.view.InflateException: Binary XML file line #317: Error inflating class <unknown>
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-15 18:30:39.600: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.Activity.setContentView(Activity.java:1657)
08-15 18:30:39.600: E/AndroidRuntime(334): at app.com.android.editor.Option.onCreate(Option.java:40)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 11 more
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: java.lang.reflect.InvocationTargetException
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Constructor.constructNative(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 25 more
08-15 18:30:39.600: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.nativeCreate(Native Method)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.TextView.<init>(TextView.java:344)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.Button.<init>(Button.java:108)
08-15 18:30:39.600: E/AndroidRuntime(334): at android.widget.Button.<init>(Button.java:104)
08-15 18:30:39.600: E/AndroidRuntime(334): ... 28 more
08-15 18:30:45.459: I/Process(334): Sending signal. PID: 334 SIG: 9
Heap sizes vary by device. It is perfectly reasonable that on devices where apps have large heap sizes you will encounter fewer problems than on devices where apps have smaller heap sizes. Your heap could be as low as 16MB, if you are supporting older/lower-resolution devices.
Most android has limited space. Usually 16MB. I highly suggest looking at your image size. Also use weak references where you can to make sure images are only using memory when accessed. (Weak references will force the garbage collected to clean them up quicker.)
And I don't know much about your app with just your logcat error list, but if you have multiple activities, kill the ones you don't need. Might seem like obvious advice, maybe not, but it will free up space.
As others stated, the heap size for an Application is limited. The minimum is 16MB and veries from device to device (it's a setting of the virtual machine).
Some suggestions what you could do:
You can load a smaller version of the image, if not needed in full resolution. Here is how to do it: http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html
Check if enough free memory is available; If memory gets low, you can just free images that are not directly needed right now and load them again, if they are needed.
Here is some code sniped for checking how much free memory is left:
long free = Runtime.getRuntime().freeMemory();
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
that line says it all.
The bitmaps are hogging all the memory of some devices (devices that the VM stack limit is higher). You should look into better memory management for this application such as LruCache, decode bitmaps with lower quality, etc.
edit:
do not use WeakReference as some users might suggest.
check this question Does Android need to load a complete Bitmap from a file before sampling it down? and also this video http://www.youtube.com/watch?v=gbQb1PVjfqM
direct explanations/teachings/techniques from the creators of the platform and say to not use WeakReference.
Related
I don't know why the app crashes whenever it's supposed to go to the next Activity. I made a practice app that works as it should when using the same format. I uploaded the files to gist.github.
The error is
1216-1216/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ArrayIndexOutOfBoundsException
at com.example.chiozokamalu.newfreshstart.MainActivity.onClick(MainActivity.java:164)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java: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)
On line 164 of MainActivity.java:
questionView.setText(questions[questionIndex]); // set the text to the next question
EDIT: After Varun helped me, I get a new error which is
1307-1307/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.chiozokamalu.newfreshstart/com.example.chiozokamalu.newfreshstart.Results1}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
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)
Caused by: java.lang.NullPointerException
at com.example.chiozokamalu.newfreshstart.Results1.onCreate(Results1.java:58)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
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)
The questions array at line no. 164 is going out of bound that means questionIndex is greater than the total length of the questions array. So you should add a check on the length before extracting value from the array.
You have added the check but after that you incremented the value so either you modify the if condition to if (questionIndex < questions.length -1)
or modify the questionIndex variable before the if condition
You are getting problem because you haven't initiated resultView9 that is why it is null and giving nullpointer, just initiatlise it as you done with other and everything is fine. You have initialised the resultView8 twice just add resultview9 over there
I have 2 classes: Main and Study. when I press the "study" button on the Main's layout it should go to the Study class but the application crashes instead.
this is the Main class Code:
package com.example.geograpp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
public class Main extends Activity implements OnClickListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View studyButton=this.findViewById(R.id.study_button);
studyButton.setOnClickListener(this);
}
#Override
public void onClick(View v) {
switch (v.getId()){
case R.id.study_button:
Intent studyIntent = new Intent(this, Study.class);
startActivity(studyIntent);
break;
}
}
}
this is the Main's layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Main"
android:background="#drawable/mainmenu_background">
<Button
android:id="#+id/study_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="94dp"
android:text="Study"
android:textColor="#color/white"
android:textSize="22sp"
android:background="#color/black"/>
<Button
android:id="#+id/about_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/game_button"
android:layout_below="#+id/game_button"
android:layout_marginTop="40dp"
android:background="#color/black"
android:text="About"
android:textColor="#color/white"
android:textSize="22sp" />
<Button
android:id="#+id/game_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/study_button"
android:layout_below="#+id/study_button"
android:layout_marginTop="38dp"
android:background="#color/black"
android:text="Game"
android:textColor="#color/white"
android:textSize="22sp" />
<Button
android:id="#+id/exit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/about_button"
android:layout_alignRight="#+id/study_button"
android:layout_below="#+id/about_button"
android:layout_marginTop="42dp"
android:background="#color/black"
android:text="Exit"
android:textColor="#color/white"
android:textSize="22sp" />
</RelativeLayout>
This is the Study class code:
package com.example.geograpp;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Study extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_study);
}
}
This is the Study's layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Study"
android:background="#drawable/study_background">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="106dp"
android:text="Choose a Continent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="#drawable/worldmap_clickable" />
</RelativeLayout>
This is the manifast
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.geograpp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.geograpp.Main"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.geograpp.Study"
android:label="#string/title_activity_study" >
</activity>
</application>
</manifest>
The log cat after the crush:
09-04 22:54:17.176: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed 49K, 53% free 2551K/5379K, external 1625K/2137K, paused 135ms
09-04 22:54:45.306: D/dalvikvm(334): GC_EXTERNAL_ALLOC freed 12K, 53% free 2577K/5379K, external 23321K/25369K, paused 62ms
09-04 22:54:45.396: E/dalvikvm-heap(334): 22216740-byte external allocation too large for this process.
09-04 22:54:45.496: E/GraphicsJNI(334): VM won't let us allocate 22216740 bytes
09-04 22:54:45.506: D/dalvikvm(334): GC_FOR_MALLOC freed <1K, 53% free 2577K/5379K, external 23321K/25369K, paused 35ms
09-04 22:54:45.506: D/skia(334): --- decoder->decode returned false
09-04 22:54:45.506: D/AndroidRuntime(334): Shutting down VM
09-04 22:54:45.506: W/dalvikvm(334): threadid=1: thread exiting with uncaught exception (group=0x40015560)
09-04 22:54:45.538: E/AndroidRuntime(334): FATAL EXCEPTION: main
09-04 22:54:45.538: E/AndroidRuntime(334): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.geograpp/com.example.geograpp.Study}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.os.Looper.loop(Looper.java:123)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Method.invoke(Method.java:507)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-04 22:54:45.538: E/AndroidRuntime(334): at dalvik.system.NativeStart.main(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.Activity.setContentView(Activity.java:1657)
09-04 22:54:45.538: E/AndroidRuntime(334): at com.example.geograpp.Study.onCreate(Study.java:12)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 11 more
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.reflect.InvocationTargetException
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Constructor.constructNative(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 21 more
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1899)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.ViewGroup.<init>(ViewGroup.java:286)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
09-04 22:54:45.538: E/AndroidRuntime(334): ... 24 more
09-04 22:55:01.926: I/Process(334): Sending signal. PID: 334 SIG: 9
Your application is crashing because your apps allowed memory limit has been exceeded. The only way to resolve this problem is to reduce the memory footprint of your app. My guess is your entire issue is related to the background set in your study layout.
android:background="#drawable/study_background"
Images are almost always the cause of OutOfMemory errors in my experience. Take a look at the resolution of this image and try to scale it down to a more appropriate size for mobile. One way to test if this is the issue is to remove the background line altogether and run the app. If you don't see any errors or the error you do see isn't the same you know the image is causing your memory problems.
To explain how I came to that conclusion take a deeper look at the last caused by line in your stack trace:
09-04 22:54:45.538: E/AndroidRuntime(334): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1951)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.View.<init>(View.java:1899)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.view.ViewGroup.<init>(ViewGroup.java:286)
09-04 22:54:45.538: E/AndroidRuntime(334): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
If you look its during a constructor call to a RelativeLayout and is running out of memory while it is trying to decode a bitmap. Higher up in the stack trace you see it causes an error inflating xml. This means that the problem occurred when the Android system was trying to turn your xml into java objects and draw this on screen. You explained you were seeing this problem when your code was trying to move to the study activity which would indicate that the issue lies somewhere in the xml for study activity. Your study activity xml only has a single RelativeLayout with a background set on it indicating this is where the problem lies.
Finally I'd like to point out you also have a bitmap set on the image view which could also need to be sized more appropriately for mobile.
android:src="#drawable/worldmap_clickable"
I am just trying to launch camera from my android emulator and I am getting the above error
unfortunately camera has stopped android emulator and it stopped
My Android Version 4.0.3 and API 15
My Logs are below ,I have already gone through the other posts in stack overflow related to this but no luck
08-15 18:55:53.361: E/EmulatedCamera_QemuClient(38): queryFrame: Query failed: Unable to obtain video frame from the camera
08-15 18:55:53.361: E/EmulatedCamera_QemuDevice(38): inWorkerThread: Unable to get current video frame: Invalid argument
08-15 18:55:53.401: I/dalvikvm(472): Wrote stack traces to '/data/anr/traces.txt'
08-15 18:55:53.561: E/Camera(472): Error 100
08-15 18:55:53.561: E/CameraErrorCallback(472): Got camera error callback. error=100
08-15 18:55:53.571: D/AndroidRuntime(472): Shutting down VM
08-15 18:55:53.571: W/dalvikvm(472): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
08-15 18:55:53.591: E/AndroidRuntime(472): FATAL EXCEPTION: main
08-15 18:55:53.591: E/AndroidRuntime(472): java.lang.RuntimeException: Media server died.
08-15 18:55:53.591: E/AndroidRuntime(472): at com.android.camera.CameraErrorCallback.onError(CameraErrorCallback.java:31)
08-15 18:55:53.591: E/AndroidRuntime(472): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:736)
08-15 18:55:53.591: E/AndroidRuntime(472): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 18:55:53.591: E/AndroidRuntime(472): at android.os.Looper.loop(Looper.java:137)
08-15 18:55:53.591: E/AndroidRuntime(472): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-15 18:55:53.591: E/AndroidRuntime(472): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 18:55:53.591: E/AndroidRuntime(472): at java.lang.reflect.Method.invoke(Method.java:511)
08-15 18:55:53.591: E/AndroidRuntime(472): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-15 18:55:53.591: E/AndroidRuntime(472): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-15 18:55:53.591: E/AndroidRuntime(472): at dalvik.system.NativeStart.main(Native Method)
08-15 18:55:53.621: W/ActivityManager(92): Force finishing activity com.android.camera/.Camera
08-15 18:55:53.631: W/WindowManager(92): Failure taking screenshot for (180x300) to layer 21015
08-15 18:55:53.811: I/Process(92): Sending signal. PID: 472 SIG: 3
08-15 18:55:53.811: I/dalvikvm(472): threadid=3: reacting to signal 3
I have an app whose first page is simply a image with loading symbol. While testing the app, when never i click on home button after starting the app and then start the app again and repeating this at very fast rate i got the following run time exception:
08-15 05:47:53.555: INFO/ActivityManager(1146): Config changed: { scale=1.0 imsi=0/0 loc=en_IN touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34}
08-15 05:47:53.655: WARN/InputManagerService(1146): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#45cc4df8
08-15 05:47:53.655: INFO/TouchPal(1248): density = 1.5
08-15 05:47:53.655: INFO/TouchPal(1248): scaledDensity = 1.5
08-15 05:47:53.655: INFO/TouchPal(1248): widthPixels = 854
08-15 05:47:53.655: INFO/TouchPal(1248): heightPixels = 480
08-15 05:47:53.655: INFO/TouchPal(1248): xdpi = 160.42105
08-15 05:47:53.655: INFO/TouchPal(1248): ydpi = 159.49706
08-15 05:47:53.655: INFO/TouchPal(1248): fontScale = 1.0
08-15 05:47:53.655: INFO/TouchPal(1248): hardKeyboardHidden = 2
08-15 05:47:53.655: INFO/TouchPal(1248): keyboard = 1
08-15 05:47:53.665: INFO/TouchPal(1248): keyboardHidden = 1
08-15 05:47:53.665: INFO/TouchPal(1248): navigation = 1
08-15 05:47:53.665: INFO/TouchPal(1248): orientation = 2
08-15 05:47:53.665: INFO/TouchPal(1248): touchscreen = 3
08-15 05:47:53.665: DEBUG/CompSplashWebViewClient(2528): onPageFinsihed/ For id: -1
08-15 05:47:53.665: DEBUG/CompSplashWebViewClient(2528): onPageFinsihed/ MAIN SCREEN URL HAS BEEN CACHED
08-15 05:47:53.665: DEBUG/FlipperController(2528): handleAction/ action : LOAD_MAIN_SCREEN
08-15 05:47:53.665: INFO/ActivityManager(1146): Starting activity: Intent { cmp=com.activities/.FlipperActivity }
08-15 05:47:53.665: INFO/TouchPal(1248): locale = English (India)
08-15 05:47:53.685: DEBUG/SplashScreenActivity(2528): onPause of BaseActivity
08-15 05:47:53.705: DEBUG/SplashScreenActivity(2528): Alarm Service Started
08-15 05:47:53.715: ERROR/TimeoutService(2528): onDestroy
08-15 05:47:53.745: DEBUG/FlipperActivity(2528): onCreate
Here this one:
08-15 05:47:53.925: ERROR/dalvikvm-heap(2528): Heap Massage needed (1728000-byte external allocation too big)
08-15 05:47:53.925: ERROR/dalvikvm-heap(2528): -->Full GC (don't collect SoftReferences)
08-15 05:47:53.985: DEBUG/dalvikvm(2528): GC freed 11520 objects / 655400 bytes in 59ms
08-15 05:47:53.985: DEBUG/dalvikvm(2528): threadid=207 wakeup: interrupted
08-15 05:47:53.985: ERROR/dalvikvm-heap(2528): -->Full GC (collect SoftReferences)
08-15 05:47:54.045: DEBUG/dalvikvm(2528): GC freed 453 objects / 210240 bytes in 53ms
What does this mean????
08-15 05:47:54.045: ERROR/dalvikvm-heap(2528): -->Heap Massage was unsuccessful for 1728000-bytes!
08-15 05:47:54.045: ERROR/dalvikvm-heap(2528): -->Heap Massage has failed...
08-15 05:47:54.045: DEBUG/AndroidRuntime(2528): Shutting down VM
08-15 05:47:54.045: WARN/dalvikvm(2528): threadid=3: thread exiting with uncaught exception (group=0x40023160)
08-15 05:47:54.045: ERROR/ACRA(2528): ACRA caught a RuntimeException exception for com.activities. Building report.
08-15 05:47:54.055: INFO/NotificationService(1146): enqueueToast pkg=com.activities callback=android.app.ITransientNotification$Stub$Proxy#45d31820 duration=1
08-15 05:47:54.075: DEBUG/ACRA(2528): Retrieve application default SharedPreferences.
08-15 05:47:54.095: INFO/global(2528): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
08-15 05:47:54.215: INFO/ACRA(2528): READ_LOGS not allowed. ACRA will not include LogCat and DropBox data.
08-15 05:47:54.565: DEBUG/dalvikvm(1146): GC freed 3519 objects / 195568 bytes in 93ms
08-15 05:47:54.745: DEBUG/dalvikvm(2528): GC freed 8487 objects / 518184 bytes in 65ms
08-15 05:47:54.985: DEBUG/dalvikvm(1146): GC freed 2087 objects / 106048 bytes in 92ms
08-15 05:47:55.235: DEBUG/dalvikvm(2528): GC freed 3220 objects / 159000 bytes in 66ms
08-15 05:47:55.375: DEBUG/dalvikvm(1146): GC freed 3682 objects / 155808 bytes in 93ms
08-15 05:47:55.425: DEBUG/ACRA(2528): Writing crash report file.
08-15 05:47:55.475: DEBUG/ACRA(2528): Mark all pending reports as approved.
08-15 05:47:55.475: DEBUG/ACRA(2528): Looking for error files in /data/data/com.activities/files
08-15 05:47:55.485: VERBOSE/ACRA(2528): About to start ReportSenderWorker from #handleException
08-15 05:47:55.485: DEBUG/ACRA(2528): Add user comment to null
08-15 05:47:55.485: DEBUG/ACRA(2528): #checkAndSendReports - start
08-15 05:47:55.485: DEBUG/ACRA(2528): Looking for error files in /data/data/com.activities/files
08-15 05:47:55.485: INFO/ACRA(2528): Sending file 1313387275000-approved.stacktrace
08-15 05:47:55.485: INFO/global(2528): Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required.
08-15 05:47:55.485: INFO/global(2528): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
08-15 05:47:55.535: DEBUG/ACRA(2528): Sending report 910c5203-3c48-4588-beae-73b126229487
08-15 05:47:55.535: DEBUG/ACRA(2528): Connect to https://spreadsheets.google.com/formResponse?formkey=**********
08-15 05:47:55.615: DEBUG/ACRA(2528): Setting httpPost headers
08-15 05:47:55.615: DEBUG/ACRA(2528): Sending request to https://spreadsheets.google.com/formResponse?****************
08-15 05:47:55.885: DEBUG/dalvikvm(1146): GC freed 2850 objects / 117392 bytes in 82ms
08-15 05:47:58.615: DEBUG/ACRA(2528): #checkAndSendReports - finish
What doses this exception means???
08-15 05:47:59.495: ERROR/ACRA(2528): Idol 2011 fatal error : Unable to start activity ComponentInfo{com.activities/com.activities.FlipperActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
08-15 05:47:59.495: ERROR/ACRA(2528): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.activities/com.activities.FlipperActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2503)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2519)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread.access$2200(ActivityThread.java:123)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.os.Looper.loop(Looper.java:123)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread.main(ActivityThread.java:4370)
08-15 05:47:59.495: ERROR/ACRA(2528): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 05:47:59.495: ERROR/ACRA(2528): at java.lang.reflect.Method.invoke(Method.java:521)
08-15 05:47:59.495: ERROR/ACRA(2528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-15 05:47:59.495: ERROR/ACRA(2528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-15 05:47:59.495: ERROR/ACRA(2528): at dalvik.system.NativeStart.main(Native Method)
08-15 05:47:59.495: ERROR/ACRA(2528): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
08-15 05:47:59.495: ERROR/ACRA(2528): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-15 05:47:59.495: ERROR/ACRA(2528): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.Activity.setContentView(Activity.java:1625)
08-15 05:47:59.495: ERROR/ACRA(2528): at com.activities.FlipperActivity.onCreate(FlipperActivity.java:123)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
08-15 05:47:59.495: ERROR/ACRA(2528): ... 11 more
08-15 05:47:59.495: ERROR/ACRA(2528): Caused by: java.lang.reflect.InvocationTargetException
08-15 05:47:59.495: ERROR/ACRA(2528): at android.widget.RelativeLayout.<init>(RelativeLayout.java:171)
08-15 05:47:59.495: ERROR/ACRA(2528): at java.lang.reflect.Constructor.constructNative(Native Method)
08-15 05:47:59.495: ERROR/ACRA(2528): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
08-15 05:47:59.495: ERROR/ACRA(2528): ... 21 more
08-15 05:47:59.495: ERROR/ACRA(2528): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.Bitmap.nativeCreate(Native Method)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.content.res.Resources.loadDrawable(Resources.java:1705)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.View.<init>(View.java:1873)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.View.<init>(View.java:1822)
08-15 05:47:59.495: ERROR/ACRA(2528): at android.view.ViewGroup.<init>(ViewGroup.java:307)
08-15 05:47:59.495: ERROR/ACRA(2528): ... 25 more
08-15 05:47:59.535: INFO/Process(2528): Sending signal. PID: 2528 SIG: 9
08-15 05:47:59.595: INFO/ActivityManager(1146): Process com.activities (pid 2528) has died.
08-15 05:47:59.595: WARN/ActivityManager(1146): Scheduling restart of crashed service com.activities/com.service.TimeoutService in 5000ms
08-15 05:47:59.595: INFO/WindowManager(1146): Setting rotation to 0, animFlags=0
08-15 05:47:59.615: DEBUG/ViewFlipper(1294): updateRunning() mVisible=false, mStarted=true, mUserPresent=true, mRunning=false
08-15 05:47:59.635: WARN/WindowManager(1146): Rebuild removed 4 windows but added 3
08-15 05:47:59.665: INFO/WindowManager(1146): WIN DEATH: Window{45c599a8 com.activities/com.activities.SplashScreenActivity paused=false}
08-15 05:47:59.705: INFO/ActivityManager(1146): Config changed: { scale=1.0 imsi=0/0 loc=en_IN touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34}
08-15 05:47:59.705: INFO/TouchPal(1248): density = 1.5
08-15 05:47:59.705: INFO/TouchPal(1248): scaledDensity = 1.5
08-15 05:47:59.705: INFO/TouchPal(1248): widthPixels = 480
08-15 05:47:59.705: INFO/TouchPal(1248): heightPixels = 854
08-15 05:47:59.705: INFO/TouchPal(1248): xdpi = 160.42105
08-15 05:47:59.705: INFO/TouchPal(1248): ydpi = 159.49706
08-15 05:47:59.705: INFO/TouchPal(1248): fontScale = 1.0
08-15 05:47:59.705: INFO/TouchPal(1248): hardKeyboardHidden = 2
08-15 05:47:59.715: INFO/TouchPal(1248): keyboard = 1
08-15 05:47:59.715: INFO/TouchPal(1248): keyboardHidden = 1
08-15 05:47:59.715: INFO/TouchPal(1248): navigation = 1
08-15 05:47:59.715: INFO/TouchPal(1248): orientation = 1
08-15 05:47:59.715: INFO/TouchPal(1248): touchscreen = 3
08-15 05:47:59.715: INFO/TouchPal(1248): locale = English (India)
08-15 05:47:59.885: INFO/UsageStats(1146): Unexpected resume of com.android.launcher while already
Can any one explain to me what is happening here?
What's weird to me is that this activity works most of the time.. And
in the cases that it does crash on an out of memory error like above.
When the Activity is paused it is not freeing the Bitmap used for the image you are loading, so when it is reloaded you consume more and more memory, until your app runs out of the memory Android makes available to it (and you get the out of memory exception).
In your Activity's pause method make sure you call Bitmap.recycle on the Bitmap you are creating when you load the image. You may need to play with the lifecycle methods and figure out where best to free/release the memory allocated when the image is loaded, but that should fix your out of memory error.
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.