• Register
0 votes

Problem :

I have the below Activity class it contains the following:

public class TestFirstActivity extends Activity { 
public void onFirstCreate(Bundle savedFirstInstanceState) {

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

SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

I have tried 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?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

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


After this if the output comes out as your app then certainly it is your app which 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 700 views
Problem : I am trying to learn Android programming also I am trying to develop a very basic weather app. My code works perfectly if I try to enter any valid city name. But I want to use the toast and it shows me the error and also to the ... .nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject. How can I fix the above error?
asked Feb 14, 2020 mphil 2.3k points
0 votes
2 answers 255 views
Problem : Currently I am working on my app for Android but I am getting following error while working with the SharedPreferences. I am very new to Android App Programming. I am trying to debug it from past 2 days but unable to find the solution ... " android:inputType="number" android:key="capitalownership" android:title="@string/capitalownership" /> Can somebody help me in resolving this error?
asked Feb 17, 2020 mphil 2.3k points
0 votes
1 answer 165 views
0 votes
2 answers 189 views
Problem : I am beginner in Android Studio and I have written code, but I keep facing below error if I try to run my code: "Error: method does not override or implement a method from a supertype". I have already spent over four hours on this error but I am unable to fix it. Can somebody help me in fixing this issue?
asked Feb 26, 2020 mphil 2.3k points
1 vote
1 answer 522 views
Problem : When I call a blank layout and afterwards call my layout it gives me the following error: the specified child already has a parent. you must call removeview() on the child's parent first.
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
2 answers 68 views
Problem : I want to add the fused location services but I am facing below error : “Cannot fit requested classes in a single dex file. try supplying a main-dex list.”
asked Dec 25, 2019 alecxe 7.5k points
1 vote
1 answer 30 views
Problem: Hey good people, I hope you are doing good. I was trying to write a program where, given a string name, e.g. "bob", return a greeting of the form "hello bob!". I was surfing over the internet and find this question from one of the websites. This problem is beyond my understanding. I looking forward to you for a solution. Thanks.
asked Mar 22, 2020 Gavin 15.3k points
0 votes
1 answer 51 views
Problem : In Java, I want to have something as below : class MyClazz<T> {  static void doIt(T object) {    // More code  } } But I face below error &ldquo;Cannot make a static reference to the non-static type T&rdquo; I am unable to understand ... about a subject. Could someone clarify if such the use is possible, by the similar manner? Also, why was my original attempt went unsuccessful?
asked Jan 21, 2020 jwilliam 3.9k points