SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length - android

Can someone explain this error?
"SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length".
I think it concerns with editText. Is there a solution for it?
This is my log.
1-07 14:29:47.654: D/OpenGLRenderer(24479): Enabling debug mode 0
01-07 14:30:36.954: E/SensorManager(24479): thread start
01-07 14:30:36.959: D/SensorManager(24479): registerListener :: handle = 0 name= LSM330DLC 3-axis Accelerometer delay= 200000 Listener=
android.view.OrientationEventListener$SensorEventListenerImpl#43000e98
01-07 14:30:37.139: E/SpannableStringBuilder(24479): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-07 14:30:37.139: E/SpannableStringBuilder(24479): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
01-07 14:30:37.419: I/Process(24479): Sending signal. PID: 24479 SIG: 9
01-07 14:30:37.654: E/Trace(25014): error opening trace file: No such file or directory (2)
01-07 14:30:37.754: D/dalvikvm(25014): GC_FOR_ALLOC freed 108K, 6% free 12258K/12931K, paused 15ms, total 16ms
01-07 14:30:37.754: I/dalvikvm-heap(25014): Grow heap (frag case) to 14.860MB for 2457616-byte allocation
01-07 14:30:37.779: D/dalvikvm(25014): GC_CONCURRENT freed 6K, 5% free 14651K/15367K, paused 12ms+2ms, total 23ms
01-07 14:30:37.809: D/dalvikvm(25014): GC_FOR_ALLOC freed 0K, 5% free 14651K/15367K, paused 11ms, total 11ms
01-07 14:30:37.819: I/dalvikvm-heap(25014): Grow heap (frag case) to 19.018MB for 4367376-byte allocation
01-07 14:30:37.834: D/dalvikvm(25014): GC_CONCURRENT freed 0K, 4% free 18917K/19655K, paused 2ms+2ms, total 16ms
01-07 14:30:37.834: D/dalvikvm(25014): WAIT_FOR_CONCURRENT_GC blocked 3ms
01-07 14:30:37.894: D/dalvikvm(25014): GC_FOR_ALLOC freed 2660K, 17% free 17674K/21063K, paused 13ms, total 13ms
01-07 14:30:37.909: D/dalvikvm(25014): GC_FOR_ALLOC freed 688K, 14% free 18212K/21063K, paused 10ms, total 10ms
01-07 14:30:37.944: D/dalvikvm(25014): GC_FOR_ALLOC freed <1K, 11% free 18890K/21063K, paused 12ms, total 12ms
01-07 14:30:37.949: I/dalvikvm-heap(25014): Grow heap (frag case) to 20.170MB for 1235556-byte allocation
01-07 14:30:37.964: D/dalvikvm(25014): GC_FOR_ALLOC freed 0K, 10% free 20097K/22279K, paused 11ms, total 11ms
01-07 14:30:38.019: D/libEGL(25014): loaded /system/lib/egl/libEGL_mali.so
01-07 14:30:38.024: D/libEGL(25014): loaded /system/lib/egl/libGLESv1_CM_mali.so
01-07 14:30:38.024: D/libEGL(25014): loaded /system/lib/egl/libGLESv2_mali.so
01-07 14:30:38.029: D/(25014): Device driver API match
01-07 14:30:38.029: D/(25014): Device driver API version: 10
01-07 14:30:38.029: D/(25014): User space API version: 10
01-07 14:30:38.029: D/(25014): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Fri Sep 28
10:42:56 KST 2012
01-07 14:30:38.064: D/OpenGLRenderer(25014): Enabling debug mode 0

Just add this property to your edit text and your problem will definitely be resolved
android:inputType="textNoSuggestions"
Add the above property to each of your edit text used in the application, or simply where you get the error in that edit text only.

It's probably because you are using 3rd party keyboard instead of the native phone keyboard.
This often happens with SwiftKey.

Just ignore them. Its because your OS might have had some new keyboards like Swype, or some other customized keyboards, and these kind of things come popping up. So you don't have to worry.

Check if you have any element such as button or text view duplicated (copied twice) in the activity xml file that corresponds to the screen where this encounters. I did this unnoticed and had to face the same issue.

Add the android:textIsSelectable="false" in editText
For example
<EditText
android:id="#+id/edit_IONumber"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:textIsSelectable="false"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_shape"
android:padding="5dip" />

Related

Logcat doesnot show errors

When I click on the share button of my App, a message shows Unfortunately has stopped. But, this doesn't cause the app to crash. I am able to share my file. The logcat doesn't show any errors. The following is what my logcat displays .
03-28 15:10:23.585 18455-18455/com.example.akn.play_music D/dalvikvm﹕ GC_FOR_ALLOC freed 208K, 2% free 17001K/17240K, paused 28ms, total 28ms
03-28 15:10:25.165 18455-18455/com.example.akn.play_music D/dalvikvm﹕ GC_FOR_ALLOC freed 142K, 2% free 17003K/17312K, paused 11ms, total 12ms
03-28 15:10:25.175 18455-18464/com.example.akn.play_music D/dalvikvm﹕ GC_FOR_ALLOC freed 3K, 2% free 17576K/17892K, paused 11ms, total 11ms

Why the GC happens so frequent in Android?

I have exit my app, but there is still a backgroud service is running. Whe the GC logs come a log. I will so you the logs beblow. You can see, about 3 logs per second. Is This phenomenon is normal ? My device's memory is enough, and the backgroud service is holding a WebSocket connection.
08-11 10:33:54.456 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2020K, 18% free 10682K/12871K, paused 12ms+6ms, total 44ms
08-11 10:33:54.776 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1985K, 18% free 10676K/12871K, paused 12ms+8ms, total 54ms
08-11 10:33:55.109 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1950K, 18% free 10671K/12871K, paused 12ms+17ms, total 68ms
08-11 10:33:55.459 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2004K, 18% free 10680K/12871K, paused 13ms+8ms, total 62ms
08-11 10:33:55.769 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2010K, 18% free 10680K/12871K, paused 12ms+7ms, total 48ms
08-11 10:33:56.093 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1996K, 18% free 10677K/12871K, paused 12ms+9ms, total 50ms
08-11 10:33:56.416 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2028K, 18% free 10681K/12871K, paused 2ms+8ms, total 37ms
08-11 10:33:56.746 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2031K, 18% free 10682K/12871K, paused 8ms+8ms, total 46ms
08-11 10:33:57.079 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1996K, 18% free 10677K/12871K, paused 12ms+7ms, total 46ms
08-11 10:33:57.429 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2002K, 18% free 10678K/12871K, paused 12ms+19ms, total 59ms
08-11 10:33:57.766 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2003K, 18% free 10679K/12871K, paused 12ms+7ms, total 46ms
08-11 10:33:58.143 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1945K, 18% free 10669K/12871K, paused 12ms+17ms, total 72ms
08-11 10:33:58.473 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2020K, 18% free 10682K/12871K, paused 2ms+6ms, total 41ms
08-11 10:33:58.786 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2013K, 17% free 10690K/12871K, paused 12ms+8ms, total 48ms
08-11 10:33:59.106 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2031K, 18% free 10683K/12871K, paused 12ms+8ms, total 53ms
08-11 10:33:59.443 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2021K, 18% free 10681K/12871K, paused 12ms+8ms, total 48ms
08-11 10:33:59.786 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 2028K, 18% free 10681K/12871K, paused 11ms+7ms, total 44ms
08-11 10:34:00.153 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕ GC_CONCURRENT freed 1997K, 18% free 10677K/12871K, paused 12ms+18ms, total 58ms
Is This phenomenon is normal ?
It depends what you mean by "normal".
If you mean normal for an application with those particular heap dimensions, that amount of heapspace used for long-lived objects, and that rate of allocation ... then the answer is "Yes, it is normal".
Basically, you are running your application with a heap that is (objectively) too small for the work that you are asking it to do. You have roughly 2Mb of free space, and you are allocating objects at roughly 6Gb per second. If you want to reduce the number of GC cycles, you need to do one or more of the following:
Increase the heap size. (I don't know if this is feasible for an Android app ...)
Reduce the "working set" of long-lived objects. Maybe you have a memory leak, lots of large images loaded, or an overly large in-memory cache of ... something.
Reduce the rate at which new objects are being allocated by your application.
The last two require you to track down the source of the memory usage / allocation, and change you code to mitigate the effects. There are tools (memory profilers) that can help with this, but the details will be specific to your application.
Here's how I'd interpret the GC log lines ... by example:
08-11 10:33:54.456 6821-6823/com.tong.iknow:ik_service_v1 E/dalvikvm﹕
GC_CONCURRENT freed 2020K, 18% free 10682K/12871K, paused 12ms+6ms, total 44ms
The "GC_CONCURRENT" collector is being used.
This GC collection cycle reclaimed 2020K bytes.
When the GC cycle completed, 18% of the heap is free, and 10682K out of a total usable heap size of 12871K is in use.
Normal thread activity was paused for two intervals of 12ms and 6ms respectively.
The elapsed time for the GC cycle was 44ms.
Note that the amount of heap freed isn't always exactly the same as the different between total and available ... because for much of the time that the GC is running there are normal threads allocating new objects.

Google Maps v2 calls System.gc() explicitly? Or how to find call to the System.gc()?

I am working with Google Maps v2 for Android.
I need to display some View over the map's marker, so I am updating its position every 16ms to keep 60fps.
And I got a problem with that code:
Point targetPosition = getMap().getProjection()
.toScreenLocation(mTrackingMarkerPos);
Because it seems that it causes explicitly calls to the System.gc() or Runtime.getRuntime().gc().
So I got this in log output:
03-12 15:00:24.362 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 122K, 10% free 12710K/14116K, paused 11ms+11ms, total 115ms
03-12 15:00:25.583 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12711K/14116K, paused 7ms+4ms, total 100ms
03-12 15:00:26.845 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12711K/14116K, paused 11ms+6ms, total 104ms
03-12 15:00:28.056 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 217K, 10% free 12710K/14116K, paused 11ms+5ms, total 98ms
03-12 15:00:29.287 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 121K, 10% free 12712K/14116K, paused 11ms+7ms, total 112ms
03-12 15:00:30.499 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12712K/14116K, paused 7ms+4ms, total 87ms
03-12 15:00:31.760 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 126K, 10% free 12711K/14116K, paused 7ms+4ms, total 130ms
As you can see, GC_EXPLICIT can pause my app for about 100ms!
So my approach to keep 60fps is not achievable because of Google Maps v2 :(
If I comment that line, GC_EXPLICIT calls will disappear. I think that problem in Google Maps v2, I checked their .class files but I did not find any calls to System.gc, so may be I am wrong...
If you know how to find call to the System.gc() I will be glad to know it too, or guys from Google can help me with this issue?
P.S. Asked this on gmaps-api-issues: https://code.google.com/p/gmaps-api-issues/issues/detail?id=6483&thanks=6483&ts=1394624273

App flicks or twinkles at some point on android 4.2.2

I have spent long time on this, this is driving me craze.
My app works all fine on android 4.1 and below. But it have a big problem running on android 4.2.2
At some point the app just start a endless flicking or twinkling, until it eat up all memory of the phone, then the phone died.
I have no idea where this problem is triggered, i don't know which line of code cause this strange problem. Because it has not bad log at all, it runs from onCreate to the final line of onResume and its all fine, but after that it just jumped in to onDestroy automatically, then run into onCreate again, it's an endless loop.
During the loops, all logs i have got is like this:
11-26 16:48:56.497 1491-1491/com.efergy.module W/EGL_emulation﹕ eglSurfaceAttrib not implemented
11-26 16:48:56.545 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 212K, 47% free 18253K/34312K, paused 1ms+0ms, total 6ms
11-26 16:48:56.549 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 6K, 47% free 18251K/34312K, paused 1ms+0ms, total 6ms
11-26 16:48:56.565 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 259K, 47% free 18505K/34312K, paused 0ms+1ms, total 4ms
11-26 16:48:56.593 1491-1491/com.efergy.module W/EGL_emulation﹕ eglSurfaceAttrib not implemented
11-26 16:48:56.649 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 269K, 47% free 18253K/34312K, paused 0ms+1ms, total 6ms
11-26 16:48:56.661 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 6K, 47% free 18251K/34312K, paused 0ms+1ms, total 7ms
11-26 16:48:56.673 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 244K, 47% free 18448K/34312K, paused 1ms+1ms, total 7ms
11-26 16:48:56.705 1491-1491/com.efergy.module W/EGL_emulation﹕ eglSurfaceAttrib not implemented
11-26 16:48:56.753 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 213K, 47% free 18254K/34312K, paused 0ms+0ms, total 5ms
11-26 16:48:56.761 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 6K, 47% free 18251K/34312K, paused 0ms+1ms, total 7ms
11-26 16:48:56.773 1491-1491/com.efergy.module D/dalvikvm﹕ GC_EXPLICIT freed 259K, 47% free 18505K/34312K, paused 0ms+0ms, total 5ms
11-26 16:48:56.793 1491-1491/com.efergy.module W/EGL_emulation﹕ eglSurfaceAttrib not implemented
Any words or recommendations to help me find out where the problem is are appreciated.
Thanks in advance.
Finally i solved this problem by myself.
In my case, it caused by the abuse of
updateConfiguration()
i use it to manage language in each activity inside
onConfigurationChanged()
Once the change of the orientation triggered the onConfigurationChanged(), inside it will call updateConfiguration() which will trigger onConfigurationChanged() again, that will running into an endless loop.
So carefully review your use of these two functions, you will find something.

Heap keeps increasing in Google Map API V2

I have got a problem which is driving me wild. I used Google Map API V2 in my Code and when I'm moving the map I can see the following Logcat output (on Nexus 7):
01-23 21:17:10.724: D/dalvikvm(5484): GC_FOR_ALLOC freed 4531K, 21% free 12911K/16312K, paused 29ms, total 29ms
01-23 21:17:10.724: I/dalvikvm-heap(5484): Grow heap (frag case) to 13.043MB for 285724-byte allocation
01-23 21:17:10.744: D/dalvikvm(5484): GC_FOR_ALLOC freed 200K, 22% free 12990K/16592K, paused 25ms, total 25ms
01-23 21:17:12.074: D/dalvikvm(5484): GC_FOR_ALLOC freed 1326K, 23% free 12893K/16592K, paused 30ms, total 31ms
01-23 21:18:04.854: D/dalvikvm(5484): Debugger has detached; object registry had 1 entries
01-23 21:18:07.374: D/dalvikvm(5484): GC_FOR_ALLOC freed 658K, 23% free 12904K/16592K, paused 27ms, total 27ms
01-23 21:18:07.384: I/dalvikvm-heap(5484): Grow heap (frag case) to 13.763MB for 1048592-byte allocation
01-23 21:18:07.404: D/dalvikvm(5484): GC_FOR_ALLOC freed 2K, 21% free 13925K/17620K, paused 27ms, total 27ms
01-23 21:18:07.714: D/dalvikvm(5484): GC_FOR_ALLOC freed 2127K, 26% free 13054K/17620K, paused 29ms, total 29ms
01-23 21:18:44.694: D/dalvikvm(5484): GC_CONCURRENT freed 1894K, 27% free 12970K/17620K, paused 4ms+5ms, total 56ms
01-23 21:18:46.684: D/dalvikvm(5484): GC_CONCURRENT freed 1738K, 27% free 12996K/17620K, paused 4ms+2ms, total 53ms
01-23 21:18:49.254: D/dalvikvm(5484): GC_CONCURRENT freed 1756K, 27% free 13014K/17620K, paused 2ms+8ms, total 77ms
01-23 21:18:56.864: I/dalvikvm(5484): Jit: resizing JitTable from 8192 to 16384
01-23 21:18:56.934: D/dalvikvm(5484): GC_CONCURRENT freed 1840K, 21% free 13010K/16312K, paused 2ms+4ms, total 49ms
01-23 21:18:59.434: D/dalvikvm(5484): GC_CONCURRENT freed 1779K, 21% free 12995K/16312K, paused 4ms+5ms, total 50ms
01-23 21:19:03.414: D/dalvikvm(5484): GC_CONCURRENT freed 1781K, 21% free 13007K/16312K, paused 2ms+3ms, total 48ms
The heap keeps growing and growing and I have no idea what I can do about it. I searched through the web and through stackoverflow, but there was no helpful answer for me.
I hope someone of you can find the error. I am very new to Android, so please appreciate.
EDIT1: Heap Dump:
EDIT2: MAT Analysis
Suspect 1:
One instance of "maps.by.a" loaded by "dalvik.system.PathClassLoader # 0x4480cfa8" occupies 1.002.352 (22,33%) bytes. The memory is accumulated in one instance of "maps.by.d" loaded by "dalvik.system.PathClassLoader # 0x4480cfa8".
Keywords
maps.by.a
dalvik.system.PathClassLoader # 0x4480cfa8
maps.by.d
Suspect 2:
3.507 instances of "java.lang.Class", loaded by "<system class loader>" occupy 795.104 (17,72%) bytes.
Biggest instances:
•class com.ibm.icu4jni.util.Resources$DefaultTimeZones # 0x401fccc8 - 151.744 (3,38%) bytes.
•class android.text.Html$HtmlParser # 0x4016d288 - 126.592 (2,82%) bytes.
•class org.apache.harmony.security.fortress.Services # 0x40091188 - 51.456 (1,15%) bytes.
Keywords
java.lang.Class
Suspect 3:
8.168 instances of "java.lang.String", loaded by "<system class loader>" occupy 529.048 (11,79%) bytes.
Keywords
java.lang.String
First, your heap doesn't "keep growing". It is hovering between 12893K and 13054K, rising and falling, with one outlier peak at 13925K. Personally, I don't see anything in that log that would worry me.
Regarding your MAT output, if those are the three top culprits, none are surprising. The latter two say "I am writing an app for Android", as those are always there on any Android app. The first one indicates that Maps V2 has one rather pudgy object. Again, I see nothing in that output that would suggest a problem.

Categories

Resources