DEV Community

CoderLegion
CoderLegion

Posted on β€’ Edited on β€’ Originally published at kodblems.com

2 1

E/spannablestringbuilder: span_exclusive_exclusive spans cannot have a zero length

πŸŽ‰ Before you dive into this article...

πŸš€ Check out our vibrant new community at CoderLegion.com!

πŸ’‘ Share your knowledge, connect with like-minded developers, and grow together.

πŸ‘‰ Click here to join now!

Problem :
I have the below Activity class it contains the following:

public class TestFirstActivity extends Activity {
public void onFirstCreate(Bundle savedFirstInstanceState) {
super.onFirstCreate(savedFirstInstanceState);
setContentView(R.layout.activity_test);

}
}
When I try to run this on my mobile device I get the below error:

SpannableStringBuilder
SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
*I have tried the above code with and without the TextView but the error still remains,

I must be doing something fundamentally very wrong for such a basic layout to cause this error.*

Does anyone have any clue on how I can get this to load without the above error?

Solution :
To try to debug your error, first, you should go to your android terminal/console and then execute the below command:

ps | grep THE_ERROR_PID_YOU_GET_(IT_IS_A_NUMBER)
*After this, if the output comes out as your app then certainly it is your app that is causing the error.

Try to look for empty Strings that you have passed into the layout.*

*I had this exact same problem in the past and it was my fault as I was passing the empty String into my then layout.

After changing my "" to " " above error went away.*

Hope this will help you in resolving your issue.

Sentry mobile image

Tired of users complaining about slow app loading and janky UI?

Improve performance with key strategies like TTID/TTFD & app start analysis.

Read the blog post

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

πŸ‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Communityβ€”every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple β€œthank you” goes a long wayβ€”express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay