No grammar constraints (DTD or XML schema) detecte

2019-06-15 07:19发布

I have the same problem as many here, but i DO HAVE xmlns:android and the xml=... tags. Still I have the same error. I don't wan't just click the ignore instead of warning in the settings so hence the question here posted.

The source is:

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >


</GridLayout>

The error:

"No grammar constraints (DTD or XML schema) detected for the document. grid_layout_test2.xml /SomeProject/res/layout line 1 XML Problem"

8条回答
可以哭但决不认输i
2楼-- · 2019-06-15 08:10

I retrieve a solution from a bug issue :

  1. Click Window > Preferences > XML > XML Files > Validation
  2. Change the setting 'validating files'>'No grammar specified' from warning to ignore.
  3. Re-validate your project. No more warnings now.

It works for me.

Be careful, my solution is a kind of "I do not understand so that I prefer to deactivate"...

查看更多
我只想做你的唯一
3楼-- · 2019-06-15 08:17

try the below

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:id="@+id/grid"
      android:layout_height="match_parent" >

</GridLayout>
查看更多
登录 后发表回答