Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

HTC sense has stopped !

So i open my app on my phone and it says HTC sense has stopped. Then it works but after testing it i can use my phone anymore because there is always that dialog box that is showed. So i have to do reset factory every time i test the app. Anyone can help me ?

Hey Brajan!

That's strange. Can you please provide a logcat of what's going on here?

To do this, please make sure you have adb set up on your device (Usually, this will be done by plugging your device in to your computer with USB Debugging enabled in the Developer Options - let me know if you need help doing this) and open the logcat window in Android Studio. You can find this by clicking on the window square in the bottom left hand corner:

Then, under logcat. make sure you have No filters enabled (So that we can read what's causing the crash in HTC Sense). As HTC Sense is actually crashing (Which is an exception), you should be fine with setting the Log level to Error:


Then, go ahead and post your logcat of the error here and I'll take a look and see what's going on :)

Thank you very much mate. This is what i get :

11-11 22:47:30.210 8094-8094/? E/cutils-trace: Error opening trace file: No such file or directory (2)
11-11 22:47:31.151 8113-8124/? E/cutils-trace: Error opening trace file: No such file or directory (2)
11-11 22:47:40.131 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36b40 successful
11-11 22:47:40.131 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36d50 successful
11-11 22:47:40.131 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b903e8 successful
11-11 22:47:40.131 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b90510 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b369b8 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36900 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36878 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b406a8 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36d50 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36c28 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b906d0 successful
11-11 22:47:40.151 251-8310/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36a58 successful
11-11 22:47:40.201 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b40708 successful
11-11 22:47:40.201 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36980 successful
11-11 22:47:40.201 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36ac0 successful
11-11 22:47:40.201 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36be8 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b405c0 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b40508 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b40438 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b65280 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36980 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b36878 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b40630 successful
11-11 22:47:40.241 251-8316/? E/OMXNodeInstance: OMX_FreeBuffer for buffer header 0xb7b0de80 successful
11-11 22:47:44.275 7745-8300/? E/dalvikvm-heap: Out of memory on a 171391192-byte allocation.
11-11 22:47:44.275 7745-8300/? E/dalvikvm-heap: Generating hprof for process: com.htc.launcher PID: 7745
11-11 22:47:44.776 7745-8300/? E/dalvikvm: can't open /data/misc/app_oom.hprof: Permission denied
11-11 22:47:44.786 7745-8300/? E/dalvikvm-heap:  hprofDumpHeap failed with result: -1 
11-11 22:47:44.786 7745-8300/? E/dalvikvm-heap: After hprofDumpHeap for process
11-11 22:47:44.786 7745-8300/? E/dalvikvm: Out of memory: Heap Size=50128KB, Allocated=40174KB, Limit=196608KB, Proc Limit=196608KB
11-11 22:47:44.786 7745-8300/? E/dalvikvm: Extra info: Footprint=50128KB, Allowed Footprint=50128KB, Trimmed=36KB
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime: FATAL EXCEPTION: TaskWorker
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime: java.lang.OutOfMemoryError: (Heap Size=50128KB, Allocated=40174KB)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:629)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:476)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:800)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.content.res.Resources.loadDrawable(Resources.java:2143)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.content.res.Resources.getDrawableForDensity(Resources.java:761)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.IconCache.getFullResIcon(IconCache.java:79)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.IconCache.getFullResIcon(IconCache.java:118)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.IconCache.getFullResIcon(IconCache.java:103)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.IconCache.cacheLocked(IconCache.java:234)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.IconCache.getTitleAndIcon(IconCache.java:160)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.ApplicationInfo.<init>(ApplicationInfo.java:72)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.pageview.AllAppsManager.loadAllAppsByBatch(AllAppsManager.java:223)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.pageview.AllAppsManager.onLoadItems(AllAppsManager.java:168)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.pageview.ItemManager.loadItems(ItemManager.java:96)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.pageview.ItemManager.loadItemsIfNotLoaded(ItemManager.java:108)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.LauncherLoader$SystemPackageTask.doRun(LauncherLoader.java:236)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.LauncherLoader$Task.run(LauncherLoader.java:101)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.LauncherLoader.load(LauncherLoader.java:703)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.LauncherLoader.triggerToLoad(LauncherLoader.java:722)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.LauncherModel$LoaderTask.run(LauncherModel.java:1220)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.task.TaskWorker$TagRunnable.run(TaskWorker.java:120)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at com.htc.launcher.task.TaskWorker$DeferredHandler$Impl.handleMessage(TaskWorker.java:191)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:99)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:158)
11-11 22:47:44.796 7745-8300/? E/AndroidRuntime:     at android.os.HandlerThread.run(HandlerThread.java:61)
11-11 22:47:44.796 596-665/? E/EmbeddedLogger: App crashed! Process: com.htc.launcher
11-11 22:47:44.796 596-665/? E/EmbeddedLogger: App crashed! Package: com.htc.launcher v532203640 (5.4.2319193261.666030.666030)
11-11 22:47:44.806 596-665/? E/EmbeddedLogger: Application Label: HTC Sense

I dont know if this helps you to find a solution. Thank you one more time :)

1 Answer

Hey Brajan!

It looks here as though your device is running out of system memory here and following the Android Lifecycle, any background apps will be suspended in order to give more memory to apps in the foreground (The app you have open).

Unfortunately, there's nothing you can do about this - it's just how Android works and that's what allows it to perform well. You can however, try freeing some device memory. There are plenty of apps on the Play Store that will do this (e.g: CCleaner.) however, you can always just swipe some apps away on your Multitasking menu (Accessible from the square button if you're using on-screen buttons):

If your app is dealing with things like input and output with files (These are not the only things, however) then you may also have a memory leak. This is often caused if you forget to close a file stream, as an example. Make sure you're not doing anything that could constantly loop code and use up memory or causing a leakage somewhere.


Hopefully this information should help you understand what's going on but if you have any more questions then feel free to give me a shout :)