The layout in layout has no declaration in the base layout folder [error]

前端 未结 22 2832
粉色の甜心
粉色の甜心 2021-01-31 13:05

After migrating to Android Studio 3.2, API 28, I am getting the following error on my app\'s layout:

The layout in layout has no declaration in the base lay

相关标签:
22条回答
  • 2021-01-31 13:46

    In my case closing and reopening Android studio solved the problem. Rebuilding the project or clearing the cache didn't help.

    0 讨论(0)
  • 2021-01-31 13:46

    If you devise your layout : layout-sw320dp layout-sw480dp layout-sw600dp layout-sw720dp ....

    you should add layout by default like this:

    enter image description here

    0 讨论(0)
  • 2021-01-31 13:46

    What worked for me is to remove the id attribute

    android:id="@+id/[id same as filename]"
    

    from the layout resource.

    0 讨论(0)
  • 2021-01-31 13:47

    I solved this issue by just syncing project with gradle

    0 讨论(0)
  • 2021-01-31 13:47

    I had an issue after copy/pasting code into an XML layout file, but I fixed it by just manually creating the file. Very strange, since the code was exactly the same, but somehow it fixed this issue. I did try restarting and doing the "File => Invalidate Caches / Restart => Invalidate and Restart" fix, but the issue was only fixed by manually recreating the file.

    0 讨论(0)
  • 2021-01-31 13:48

    In my case it seems that Google used to expect (or at least accept) different names between different layouts; I had a time_dialog.xml and a time_dialog_landscape.xml. Renaming the latter to time_dialog.xml fixed the problem.

    0 讨论(0)
提交回复
热议问题