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

前端 未结 22 2903
粉色の甜心
粉色の甜心 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:49

    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.)

     
          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

提交回复
热议问题