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.
Related
I'm programming Android 2.3 (API 10) application.
I've managed to create a custom view to my Notification object with ImageView and TextView.
I want to add to my Notification a ToggleButton (Kind of like the toggle button exists in the phone call options in the notification when you're in a middle of a phone call with "Speaker" and "Mute" Toggle buttons).
Every time i'm trying to do so - my application's crash with the following error:
08-15 00:15:55.370: E/AndroidRuntime(17000): FATAL EXCEPTION: main
08-15 00:15:55.370: E/AndroidRuntime(17000): android.app.RemoteServiceException: Bad notification posted from package com.coapps.pico: Couldn't expand RemoteViews for: StatusBarNotification(package=com.coapps.pico id=0 tag=null notification=Notification(vibrate=null,sound=null,defaults=0x0,flags=0x0))
08-15 00:15:55.370: E/AndroidRuntime(17000): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1048)
08-15 00:15:55.370: E/AndroidRuntime(17000): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 00:15:55.370: E/AndroidRuntime(17000): at android.os.Looper.loop(Looper.java:130)
08-15 00:15:55.370: E/AndroidRuntime(17000): at android.app.ActivityThread.main(ActivityThread.java:3691)
08-15 00:15:55.370: E/AndroidRuntime(17000): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 00:15:55.370: E/AndroidRuntime(17000): at java.lang.reflect.Method.invoke(Method.java:507)
08-15 00:15:55.370: E/AndroidRuntime(17000): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
08-15 00:15:55.370: E/AndroidRuntime(17000): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
08-15 00:15:55.370: E/AndroidRuntime(17000): at dalvik.system.NativeStart.main(Native Method)
Any idea how can i make it work ?
Usually bad notification error occurs during notification building process;
when you try to include views which are not ought to be used in notification(Here is the reference to the video where it is mentioned "https://www.youtube.com/watch?v=ToUR9i4Smfw").
Conclusion:
Remove ToggleButton from custom layout;
try to use ImageButton instead.
Integrating facebook sdk with android app.before integrating app working fine but once working with facebook app stopped unexpectedly here i am placing the code.suggest me how to fix this
public class MainActivity extends Activity implements OnClickListener {
Button btnTOLogin, btnTOPost, logOut;
String APP_ID;
Facebook fb;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
APP_ID = "308180782571605";
fb = new Facebook(APP_ID);
try {
btnTOLogin = (Button) findViewById(R.id.button1);
btnTOPost = (Button) findViewById(R.id.button2);
logOut = (Button) findViewById(R.id.button3);
btnTOLogin.setOnClickListener(this);
btnTOPost.setOnClickListener(this);
logOut.setOnClickListener(this);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
here logs
08-15 22:08:52.531: E/AndroidRuntime(2151): FATAL EXCEPTION: main
08-15 22:08:52.531: E/AndroidRuntime(2151): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.sri.z4globalsoft.MainActivity.onCreate(MainActivity.java:25)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.Activity.performCreate(Activity.java:4465)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.access$600(ActivityThread.java:122)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.os.Looper.loop(Looper.java:137)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.main(ActivityThread.java:4340)
08-15 22:08:52.531: E/AndroidRuntime(2151): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 22:08:52.531: E/AndroidRuntime(2151): at java.lang.reflect.Method.invoke(Method.java:511)
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-15 22:08:52.531: E/AndroidRuntime(2151): at dalvik.system.NativeStart.main(Native Method)
Go to Project -> Properties -> Java Build Path -> Order & Export and make sure facebook library is ticked.
clean the project..|
go to libs folder select facebookjar right click and select add to build path
(or) Java Build Path -> Order & Export and make sure facebook library is ticked.
some times it depends on order of libraries in order and export move up and down check it may come
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 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.
My problem is in starting new activities.
I have ListView, items of it are defined from string-array by this code:
listBanksUA = getResources().getStringArray(R.array.list_banks_ua);
setListAdapter(new ArrayAdapter<String(this,android.R.layout.simple_list_item_1,listBanksUA));
List is defined in layout as:
<ListView android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"/>
So, I'd like to start new activity after click on item of ListView. Sure, I have created new XML-layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="#+id/listRegions"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"/>
</LinearLayout>
and Java-class for it: ListRegionsActivity.class.
In my first Activity I use the follow code to start new Activity:
#Override
protected void onListItemClick(ListView l, View v, int position, long id)
{
startActivity(new Intent(MainActivity.this,ListRegionsActivity.class));
}
and after clicking in started application I'm getting an error, that my application has been closed with advice to try again. Sadness...
So, really I'll be glad for any help for me.
BTW: of course, I added new activity to manifest file.
UPD: my LogCAT with Error flag
08-15 13:46:45.458: ERROR/AndroidRuntime(516): Uncaught handler: thread main exiting due to uncaught exception
08-15 13:46:45.488: ERROR/AndroidRuntime(516): java.lang.RuntimeException: Unable to start activity ComponentInfo{ua.donetsk.jeston.android/ua.donetsk.jeston.android.ListRegionsActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.os.Looper.loop(Looper.java:123)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread.main(ActivityThread.java:4203)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at java.lang.reflect.Method.invoke(Method.java:521)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at dalvik.system.NativeStart.main(Native Method)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ListActivity.onContentChanged(ListActivity.java:236)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.Activity.setContentView(Activity.java:1620)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at ua.donetsk.jeston.android.ListRegionsActivity.onCreate(ListRegionsActivity.java:15)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
08-15 13:46:45.488: ERROR/AndroidRuntime(516): ... 11 more
UPD: the problem is solved. The reason was in incorrect mistake in opening avtivity - setContentView should be deleted.
Since you did not showed us the LogCat trace, I can do the guess.
Try this in the ListView click listener
MainActivity.this.startActivity(new Intent(MainActivity.this,ListRegionsActivity.class))
And dont forget to add the new activity in your manifest.
Check you're not importing android.R in your app instead of your.package.R