getActiveNotifications() make out of memory - android

I have a problem with fatal exeption. I need to get notifications from phone. That line make it:
StatusBarNotification[] notificationsArray = getActiveNotifications();
But it make error sometimes on some devices:
Fatal Exception: java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreateFromParcel(Bitmap.java)
at android.graphics.Bitmap.access$000(Bitmap.java:34)
at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1565)
at android.graphics.Bitmap$1.createFromParcel(Bitmap.java:1557)
at android.widget.RemoteViews$BitmapCache.(RemoteViews.java)
at android.widget.RemoteViews.(RemoteViews.java)
at android.widget.RemoteViews.(RemoteViews.java)
at android.widget.RemoteViews$2.createFromParcel(RemoteViews.java:3049)
at android.widget.RemoteViews$2.createFromParcel(RemoteViews.java:3047)
at android.app.Notification.(Notification.java)
at android.service.notification.StatusBarNotification.(StatusBarNotification.java)
at android.service.notification.StatusBarNotification$1.createFromParcel(StatusBarNotification.java:121)
at android.service.notification.StatusBarNotification$1.createFromParcel(StatusBarNotification.java:118)
at android.os.Parcel.createTypedArray(Parcel.java:1935)
at android.app.INotificationManager$Stub$Proxy.getActiveNotificationsFromListener(INotificationManager.java:528)
at android.service.notification.NotificationListenerService.getActiveNotifications(NotificationListenerService.java:149)
at com.hexati.lockscreentemplate.service.NotificationService.sendAll(NotificationService.java:380)
at com.hexati.lockscreentemplate.service.NotificationService.access$200(NotificationService.java:60)
at com.hexati.lockscreentemplate.service.NotificationService$NotificationsReceiver.onReceive(NotificationService.java:419)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:772)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(NativeStart.java)
How I can fix that problem?

Related

Android ANR/Crash on 4.4 version

All,
I am facing a ANR/Crash on Android 4.4 devices. Below are the mention log which I received from device. Still I an not able to debug/relate this issue. Could someone please help me to trace and fixed this issue.
at android.view.GLES20Canvas.nDrawDisplayList(Native Method) at
android.view.GLES20Canvas.drawDisplayList(GLES20Canvas.java:420) at
android.view.HardwareRenderer$GlRenderer.drawDisplayList(HardwareRenderer.java:1661)
at
android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1484)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2685) at
android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2551) at
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2157) at
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1239) at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6396)
at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:813)
at android.view.Choreographer.doCallbacks(Choreographer.java:613) at
android.view.Choreographer.doFrame(Choreographer.java:583) at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:799)
at android.os.Handler.handleCallback(Handler.java:733) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:146) at
android.app.ActivityThread.main(ActivityThread.java:5511) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at
dalvik.system.NativeStart.main(Native Method)
Please check and help me to fixing this.
Thanks
Amit
Try to disable hardware acceleration for the scrollview at runtime.
View scroll = layout.findViewById(R.id.scrollView1);
scroll.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
I found this for more detailed explanation it may helps you check once
WebView in ScrollView: "View too large to fit into drawing cache" - how to rework layout?

Error on SIMPLE ANDROID OCR

When I tried the Simple Android OCR (https://github.com/GautamGupta/Simple-Android-OCR) in ANDROID STUDIO it gave me a runtime error as shown in the picture. Can anyone help me with this?
![Runtime error occured when tried to run][2]
06-03 12:44:31.904 17051-17051/com.startup.vrvijay.liccamera E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.startup.vrvijay.liccamera, PID: 17051
android.util.SuperNotCalledException: Activity {com.startup.vrvijay.liccamera/com.startup.vrvijay.liccamera.MainActivity} did not call through to super.onCreate()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2333)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
at dalvik.system.NativeStart.main(Native Method)
You forgot to place:
super.onCreate(savedInstanceState);
right after your
protected void onCreate(Bundle savedInstanceState) {

Android getLaunchIntentForPackage returns null

I am making the following call:
Intent launchIntent = context.getPackageManager()
.getLaunchIntentForPackage(packageName);
It crashes with NPE with the following stackTrace:
java.lang.NullPointerException at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1423)
at android.app.Activity.startActivityForResult(Activity.java:3584) at
android.app.Activity.startActivityForResult(Activity.java:3545) at
android.support.v4.app.FragmentActivity.void
startActivityForResult(android.content.Intent,int)(SourceFile:817) at
android.app.Activity.startActivity(Activity.java:3787) at
android.app.Activity.startActivity(Activity.java:3755) at
utils.AppsLauncher.voidlaunchApp(android.content.Context,java.lang.String)(SourceFile:100)
at utils.AppsLauncher.void
launchAppIfInstalledOtherwiseMarket(android.app.Activity,java.lang.String,utils.AppReportingParams)(SourceFile:73)
at utils.AppsLauncher.void
launchAppIfInstalledOtherwiseMarket(android.app.Activity,java.lang.String)(SourceFile:51)
at adapters.BaseGamesListAdapter.void
launchAppIfInstalledOtherwiseMarket(java.lang.String)(SourceFile:119)
at
adapters.UserGamesAdapter$UserGameUIHolder$1.void
onClick(android.view.View)(SourceFile:198) at
android.view.View.performClick(View.java:4658) at
android.view.View$PerformClick.run(View.java:19461) at
android.os.Handler.handleCallback(Handler.java:733) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:146) at
android.app.ActivityThread.main(ActivityThread.java:5692) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at
dalvik.system.NativeStart.main(Native Method)
I assume that getLaunchIntentForPackage(packageName) returns a null Intent. I can't figure out in GREPcode why exactly it returns null: (http://grepcode.com/file/repo1.maven.org/maven2/org.robolectric/android-all/5.0.0_r2-robolectric-0/android/app/ApplicationPackageManager.java#ApplicationPackageManager.getLaunchIntentForPackage%28java.lang.String%29)
It is important to note that the package does indeed exist and is installed on the device.
The context or context.getPackageManager() is null.

Apache Log4j in Android gives exception java.lang.VerifyError: org/apache/log4j/config/PropertySetter

I am trying to integrate Flickr in android using the Flickr4Java library. Flickr4Java uses Log4j for logging. So when I try to create an instance of flickr, something like Flickr flickr = new Flickr(apiKey, sharedSecret, new REST()); I get the following stack trace
05-12 01:24:28.714 8449-8449/edu.sdsu.cs.sharepic E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: edu.sdsu.cs.sharepic, PID: 8449
java.lang.VerifyError: org/apache/log4j/config/PropertySetter
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:805)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:117)
at com.flickr4java.flickr.REST.<clinit>(REST.java:46)
at edu.sdsu.cs.sharepic.model.Flickr1.<init>(Flickr1.java:28)
at edu.sdsu.cs.sharepic.activity.SelectProfileActivity.init(SelectProfileActivity.java:75)
at edu.sdsu.cs.sharepic.activity.SelectProfileActivity.onCreate(SelectProfileActivity.java:41)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I am guessing it has got something to do with configuration of the log4j library, but don't know how to solve the problem. Any help will be much appreciated.
Log4j uses apis from java.beans that is missing in android.
Try this library https://code.google.com/archive/p/android-logging-log4j/
I have yet to look at it tough

ArithmeticExcpetion in GridView

Hi All I am getting an ArithmeticException in my Google Play crash Reports. I am not able to reproduce it locally hence I have to rely on only these reports.
I am using the GridViews in my app, I am setting the Number of Columns manually instead of setting it to "auto_fit". I am not sure why this crash is happening.
The Following is the stack Trace, any help would be appreciated;
*
java.lang.ArithmeticException: divide by zero
at android.widget.GridView.onInitializeAccessibilityNodeInfo(GridView.java:2296)
at android.view.View.createAccessibilityNodeInfoInternal(View.java:5493)
at android.view.View.createAccessibilityNodeInfo(View.java:5480)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:811)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:834)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:720)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:147)
at android.view.AccessibilityInteractionController.access$300(AccessibilityInteractionController.java:49)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:971)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5748)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
*
Thanks and Regards,
Shashi Kiran G M

Categories

Resources