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
In my case the same error was showing because layout-land file and layout filename was different.
My Case: layout-land -> my_layout_land layout -> my_layout
I solved it by making both filenames the same. Because if you are using layout-land and you have a file in layout-land then you must have a file in layout folder also.
In my case i resolved that with this:
the Android say me this id-error:MissingDefaultResource as documentation say:
If a resource is only defined in folders with qualifiers like -land or -en, and there is no default declaration in the base folder (layout or values etc), then the app will crash if that resource is accessed on a device where the device is in a configuration missing the given qualifier.
As a special case, drawables do not have to be specified in the base folder; if there is a match in a density folder (such as drawable-mdpi) that image will be used and scaled. Note however that if you only specify a drawable in a folder like drawable-en-hdpi, the app will crash in non-English locales.
There may be scenarios where you have a resource, such as a -fr drawable, which is only referenced from some other resource with the same qualifiers (such as a -fr style), which itself has safe fallbacks. However, this still makes it possible for somebody to accidentally reference the drawable and crash, so it is safer to create a default dummy fallback in the base folder. Alternatively, you can suppress the issue by adding tools:ignore="MissingDefaultResource" on the element.
(This scenario frequently happens with string translations, where you might delete code and the corresponding resources, but forget to delete a translation. There is a dedicated issue id for that scenario, with the id ExtraTranslation.)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingDefaultResource" <!--this-->
android:layout_width="match_parent"
android:layout_height="match_parent">
But this is the easy solution, 'cause you make missing the resourse in Android.
I resolve this with file system option. If Android tell you about missing resourse meaning some thing is missing and you should replenish that.
you should be go to \app\src\main\res
maybe: right click in file's missing folder, show in Exporer,and go back to \app\src\main\res
You should be find
/layout
/layout-normal
/layout-large
/some more folders
You should be find where do the files is missing. In my case that's missing in /layout
What solved it for me:
In Android Studio, right-click on the filename in the layout directory, and choose Reformat code, with no special tickbox selected on the next screen.
Not sure what exactly goes on under the hood here, but that worked.
Nothing worked for me like rebuilding the project or Invalidating the cache. In my case closing and reopening Android studio solved the problem.