Fix the XML error

Asked

Viewed 645 times

0

inserir a descrição da imagem aquiMy apps made in Android Studio 2.2.2 give XML error. Classes are as if undeclared. I’ve even asked such a question here, but it had no error specified. the error that appears in Logcat is this:

Invalid ranges during formatting in Language: XML

  • We need the code. Also, Logcat is not relevant if the error is build. We need what appears in the "Messages" tab, which is the output of Gradle errors.

  • What code you are talking about Pablo. Because in the message tab there is nothing wrong.. says all is well...but the classes appear in red as if you were not declared. so far no one has been able to figure out the error.

  • Can you put a screenshot of this? Show what appears right after trying to compile.

  • as I said in the message tab there is no error. but look where the arrow is. this is an xml error because it does not recognize the Activity.

2 answers

1

It is difficult to specify exactly what is happening with the little information that is available, but looking at an example I had, what I can suggest is to change the name of the activity there inside the Manifest to:

<activity android:name=".MainActivity" 

You don’t need the name of the package, maybe this is what’s screwing up. Perhaps this reply would be more appropriate for a comment but I don’t have enough reputation.

I hope I’ve helped.

  • u helped a lot, any comment or suggestion are welcome

  • @Legolas if the answer worked please accept, so anyone who comes to the site in the future knows that using this strategy can solve the problem (: And I’m glad it worked

0

The liofontes' answer is correct. The way you are declaring this "too complete", when it becomes redundant android studio refuses as error, because this full statement it does alone. Another thing that happens a lot to me is the need to rewrite the classes or tags when I copy and paste the code from one place to another, I do not understand why but even being correct android accuses error and after I rewrite some. Try this too, rewrite, close Android Studio and see if add error.. Anyway the placement of Activity given by the leofontes is correct, uses it and tests.

  • Ramon, I did as you said... and it worked out..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.