I am developing a phonegap based android app by using jquery mobile, but pages in my application are not scrolling and on touch events, I am getting these messages in android logcat -
12-26 11:37:50.023: WARN/webview(11326): Miss a drag as we are waiting for WebCore's response for touch down.
12-26 11:37:50.429: INFO/InputReader(1489): dispatchTouch::touch event's action is 0
12-26 11:37:50.429: INFO/InputDispatcher(1489): Delivering touch to current input target
12-26 11:37:50.554: INFO/InputReader(1489): dispatchTouch::touch event's action is 1
12-26 11:37:50.554: INFO/InputDispatcher(1489): Delivering touch to current input target
12-26 11:37:50.554: VERBOSE/webview(11326): singleCursorHandlerTouchEvent getEditableSupport FASLE
also,(it might be helpful) I am using photoswipe.js for touch based image gallery. Can somebody tell what might be the reason for pages not scrolling.
I found the answer, it might be helpful for other people. the issue was that one of my html pages had one iframe showing youtube video content,apparently android(particularly versions before android 3 dont like iframes). Fixed it by removing the iframe.
Related
Summary
I work on an Android app which, as one of its features, involves users marking up an image and saving it. This process involves some heavy canvas drawImage() calls (sometimes on an image around 12 MB+ uncompressed) as well as lots of encoding and decoding of data. The image data also cached in the Android file system and passed from Java to JavaScript through a JavaScriptInterface.
However, with an LG G Pad X8.3 running Android 5.0.2, we are getting lots of crashing. When it crashes, the log says "WIN DEATH" and it goes back to the home screen without showing any "Unfortunately, ___ has stopped" message. Our "WIN DEATH" is preceded by a win death of the InputMethod and before that a "WIN DEATH" of com.lge.launcher2.Launcher. It is intermittent, but frequent enough to be a big problem.
Details
(1) It seems to happen after the heavy image saving manipulation, but not immediately after
(2) It happens more often when the keyboard is brought up. Is something about bringing up the keyboard causing it to crash?
(3) When watching the memory usage in Android Studio as the app is running, nothing is too out of the ordinary. When it crashes, there is still free memory available in the graph.
(3) We tried using largeHeap in our manifest, but that did not eliminate the crashing.
(4) Memory usage is between 10 and 20 MB.
(5) I can add around 32 million numbers to a JavaScript array before the web view crashes. That's at least 240 MB (8 bytes per JS number). When it crashes, it shows a blank screen, as opposed to the crash I am trying to fix where it brings you back to the home screen.
(6) There is a well publicized memory leak (or a couple, actually) in this version of Android, but LG does not offer upgrades for this model.
(7) We have tried optimizing the code to use as little memory as possible, but the crashing remains.
(8) The crash logs always contain similar information around the crash.
02-08 12:13:01.642 1850-1850/? I/PhoneApp﹕ onTrimMemory: 5
02-08 12:13:01.642 1850-1850/? I/PhoneApp﹕ trim memory
02-08 12:13:01.652 945-965/? I/ActivityManager﹕ Process com.google.android.partnersetup (pid 23908) has died
02-08 12:13:01.682 945-16584/? I/ActivityManager﹕ Process com.google.android.apps.plus (pid 23756) has died
02-08 12:13:01.692 1850-1850/? I/PhoneApp﹕ onTrimMemory: 10
02-08 12:13:01.692 1850-1850/? I/PhoneApp﹕ trim memory
02-08 12:13:01.712 945-2088/? I/ActivityManager﹕ Process com.lge.p2p (pid 24102) has died
02-08 12:13:01.742 945-2041/? I/ActivityManager﹕ Process com.google.android.gms.wearable (pid 23833) has died
02-08 12:13:01.752 1850-1850/? I/PhoneApp﹕ onTrimMemory: 15
...
02-08 12:11:06.862 22936-22936/com.mycompany.ourapp W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection
...
02-08 12:11:06.912 20890-20890/? D/Cliptray Manager﹕ isAvailable() UserHandle.myUserId() = 0, isOwner = true
02-08 12:11:06.912 1961-8134/? I/Cliptray Service﹕ Standard mode!! ClipTray is Supported!
02-08 12:11:06.912 1961-8134/? D/Cliptray Service﹕ isAvailable() mLastIsOwner = true
02-08 12:11:06.912 1961-8134/? I/Cliptray Service﹕ Owner!! ClipTray is Supported! mIsOwnerClipTray = true
02-08 12:11:06.912 1961-8134/? D/Cliptray Service﹕ ignore packageName : com.mycompany.ourapp
...
02-08 12:12:39.782 22936-22936/com.mycompany.ourapp I/Choreographer﹕ Skipped 35 frames! The application may be doing too much work on its main thread.
...
02-08 12:13:02.622 945-2086/? I/WindowState﹕ WIN DEATH: Window{8dce4a3 u0 com.lge.launcher2/com.lge.launcher2.Launcher}
...
02-08 12:13:02.872 945-1922/? I/WindowState﹕ WIN DEATH: Window{393167d2 u0 InputMethod}
...
02-08 12:13:03.052 1979-1979/? D/QC_RIL_OEM_HOOK﹕ The connection to the service got disconnected unexpectedly!
02-08 12:13:03.052 1961-1961/? D/QC_RIL_OEM_HOOK﹕ The connection to the service got disconnected unexpectedly!
02-08 12:13:03.052 1850-1850/? D/QC_RIL_OEM_HOOK﹕ The connection to the service got disconnected unexpectedly!
02-08 12:13:03.052 1850-1850/? D/QC_RIL_OEM_HOOK﹕ The connection to the service got disconnected unexpectedly!
02-08 12:13:03.072 945-945/? W/InputMethodManagerService﹕ Session failed to close due to remote exception
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:496)
at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305)
at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1463)
at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1454)
at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:1480)
at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:1499)
at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1391)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1405)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at com.android.server.SystemServer.run(SystemServer.java:302)
at com.android.server.SystemServer.main(SystemServer.java:203)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
...
02-08 12:13:03.132 945-2088/? I/ActivityManager﹕ Process com.google.process.gapps (pid 21317) has died
...
02-08 12:13:03.182 1405-1405/? D/LGKeyguardUnlockMethodController﹕ onTrustChanged with userId : 0 , getUserTrustIsManaged : false ,getUserHasTrust : false
...
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ 22936 died, releasing its sessions
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ pid 1850 # 0
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ pid 22936 # 1
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ removing entry for pid 22936 session 520
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ purging stale effects
02-08 12:13:03.452 362-1705/? V/AudioFlinger﹕ remove track (4097) and delete from mixer
02-08 12:13:03.452 945-2086/? I/WindowState﹕ WIN DEATH: Window{3eafa2d1 u0 com.mycompany.ourapp/com.mycompany.ourapp.MainActivity}
The memory leak that may be partially responsible: https://code.google.com/p/android/issues/detail?id=79729
Question
What could be causing the app to crash in this way? Is it a memory issue? is anything in the log output that I've copied here relevant?
Has anyone else had this problem and solved it? Is the Android 5.0.x/1.x memory leak bug responsible?
I wish I could be more specific, but the code is proprietary and the problem isn't (or hasn't yet been) localized to any one particular code sample. If more information is needed about a particular issue, please ask.
Update
I've noticed that there are a bunch of Choreographer messages in the logs about it doing too much work, but they are relatively small frame skips (~ 35 frames) and the last message occurs a full 20 seconds before the app crashed.
Update 2-10-16
We are now trying to reuse canvas objects in case they are not garbage collected, and we are also calling System.gc() when onTrimMemory is called with TRIM_MEMORY_RUNNING_LOW. This seems to have reduced the crashing to some degree, but still frequently enough to be concerning. Most of all, I would like to understand why it seems to randomly use up too much memory and crash. I've added the onTrimMemory lines to the log output below, which show it going from low to critical in a span of 100 ms. If this only happened when actually performing the memory-intensive actions, that would make sense, but it happens sometimes long after the user process has finished.
Pulling my hair out over here, trying to get a HTML Canvas based application running in CrossWalk on a Fire TV Stick. The app would run fine then crash after 30 minutes of use with this error. I was able to fix it but my use case is pretty specific, either way it may help folks who show up here later.
TL;DR: Reduce the size of textures being loaded into and out of the GPU.
I had a fullscreen canvas element running PixiJS, working essentially as a slideshow. The problem came from a single slide type, where large images with transparency would animate over a fixed background. After logging the CPU/GPU usage in Chrome's timeline feature I could see that the textures were being loaded into and out of the GPU all the time to accomplish the affect. Ultimately, I was able to resolve the issue by completely removing the background image element from canvas, and just displaying it in a div behind the canvas. The affect was identical, but the performance was improved significantly and this problem disappeared afterwards.
You are dealing with large bitmaps and loading all of them at run
time. You have to deal very carefully with large bitmaps by loading
the size that you need not the whole bitmap at once and then do
scaling.
Huge JavaScript Cause This
Given that you are working with limited memory, ideally you only want to load a lower resolution version in memory. The lower resolution version should match the size of the UI component that displays it. An image with a higher resolution does not provide any visible benefit, but still takes up precious memory and incurs additional performance overhead due to additional on the fly scaling.
Please check Managing Bitmap Memory.
You are using lots of canvas at once that's why this problem .
This used to happen with me, even after i used the large heap attribute in application manifest and it stopped to happen when i reset all the variable to null after finishing using them.
I don`t know your code but i would advise you to re-use the same variables and make sure you clean up after every operation and when done, because keeping in the memory large unused files is not good.
When I open a link from a barcode reader that calls an action on my site the controller is called twice and the session data is reset on the second call.
If I open a browser and paste the same URL directly into it, then the controller is only called once. If I follow the same link from an email the controller is only called once.
This is happening in Firefox, Chrome, and Safari on Android and iPhone. Any clues to why opening the browser from a link would force my website to load twice?
Edit: I've tried multiple barcode readers on iPhone and Android with the same result, the page loads twice even if it is stripped down. However, it is not happening in email links as originally stated. The email links went to a different page with a different problem, when directed to the same page as the barcode scan they do not load twice. I have corrected the info above to reflect this.
Edit 2: Here are the logs from my server for an iPad following a link in a barcode scanner. Note that the first two logs are the same except the last digit.
2016-01-29 13:19:34 69.94.136.16 GET /MyPage/ABCDEF - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 - 200 0 0 93
2016-01-29 13:19:34 69.94.136.16 GET /MyPage/ABCDEF - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 - 200 0 0 109
2016-01-29 13:19:34 69.94.136.16 GET /Scripts/jquery-2.1.1.min.js - 80 - 24.62.217.163 Mozilla/5.0+(iPad;+CPU+OS+9_2+like+Mac+OS+X)+AppleWebKit/601.1.46+(KHTML,+like+Gecko)+Mobile/13C75 http://example.com/MyPage/ABCDEF 200 0 0 328
Edit 3: Here is a fairly typical version for Android from the logs:
2016-01-29 13:14:28 69.94.136.16 GET /MyPage/ABCDEF - 80 - 77.234.44.145 ZXing+(Android) - 200 0 0 125
2016-01-29 13:14:47 69.94.136.16 GET /MyPage/ABCDEF - 80 - 77.234.44.145 Mozilla/5.0+(Linux;+Android+5.1.1;+VS985+4G+Build/LMY47V)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/47.0.2526.83+Mobile+Safari/537.36 - 200 0 0 109
I found the problem for anyone else who comes here seeking. It turns out the barcode readers are calling GET so they can get the page and show its title to the user (and perhaps they get it for other reasons as well).
So, the page gets called by the reader and by the user when he follows the link. That is why a page with no images or missing links gets loaded twice from a barcode reader.
First check references on your page, maybe they are doing second request - for example if you have css or script reference with empty path. The easiest way to test that is to setup one simple view just with "Helloo" text, and try open that from link or android app.
I can't seem to get the camera to work on ICS. My original code worked fine in Froyo but now I'm getting this error in ICS:
02-27 11:54:46.781: E/CameraHAL(118): Sending shutter callback
02-27 11:54:46.820: E/CameraHAL(118): Empty Frame Queue
02-27 11:54:46.820: E/CameraHAL(118): Frame returned when ref count is already zero!!
02-27 11:54:46.875: E/CameraHAL(118): Adapter state switch PREVIEW_ACTIVE Invalid Op! event = 0x5
I was wondering if anyone knew what this meant or can point me to a working camera demo that works on ICS and I'll try to figure it out myself. I'm not pasting any code because I'm not even sure where it's happening. Thanks.
It seems like this was caused by stopPreview() for me. Removing it fixed it... but I don't know when I'm supposed to stop the preview now or if it's even necessary.
i have a question regarding some weird logcat outputs.
Scenario:
I have a listactivity with images and textviews, etc. The images are loaded by Fedor's implementation of LazyList. I changed his cache to a LRUMap from commons.
On scrolling i got sometimes a stuttering and logcats shows me a lot of this messages:
V/WindowManager( 2482): Dsptch > Window{48267640 <packagename to Listactivity> paused=false}
V/InputDevice( 2482): ID[0]=0(0) Up(1=>0)
Any ideas what these messages mean?
Thx in advance
I'm developing an Android game and I've got the garbage collection to
the point where it GC's only about once every 5 minutes or so, which I
think is acceptable, for now.
The problem is that, every once in a while, I'll see this message in
the logs:
08-29 09:58:46.410 W/copybit ( 1912): stretch_copybit::run_render fail
08-29 09:59:09.000 E/libs3c2drender( 1912): int
S3c2DRender::DoG2D(unsigned int, s3c_img*, s3c_rect*, unsigned int,
s3c_img*, s3c_rect*, int, int)::S3C_G2D_ROTATOR_18176 fail
And when this message comes up, my game seems to pause for about
100-200 milliseconds..
I'm currently using a Canvas to draw with, although if my memory is
accurate, I've seen this same error message using Open GL as well.
Here's my code to draw the image object:
cachedMatrix.reset();
cachedMatrix.postTranslate(-halfImageWidth, -halfImageHeight);
cachedMatrix.postScale(localScaleX, localScaleY);
cachedMatrix.postTranslate(localOffset.x, localOffset.y);
float degrees = (radiansToDegrees(-rotation) + 360f) % 360f;
cachedMatrix.postRotate(degrees);
cachedMatrix.postTranslate(screenPos.x, screenPos.y);
canvas.drawBitmap(image, cachedMatrix, null);
Frankly, I am at a loss as to how to get around this. This is happening on my Samsung Moment phone.
Has anyone else encountered this issue ? And found a workaround or
insights into why this is happening ?