Multiple swXXXdp/dimens.xml files require to multiple my layouts.xml in a simular structure

Viewed 41

I just want to define multiple values-swXXXdp-folders containing a dimens.xml. This one dimen attribute goes to search_fragment.xml located in layout-folder to define android:layout_width="@dimen/searchfragment_left_side_horizontal". In Android Studio layout preview everything is as expected.

When I run the app the following exception occures. It expects the layout.xml to be in a equal folder structure like the dimens.xml is (layout-sw320dp, layout-sw480dp...). But the layout can be just one file and doen't need to be multiplied.

If I create a layout folder matching my testdevices (sw320dp, sw480dp) and put a fragment.xml in it, it works. Otherwise this exception. Using data-binding, cleared all data, invalidated...

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rucksack.localpickup.debug/com.rucksack.localpickup.ui.main.search.SearchActivity}: java.lang.IllegalArgumentException: The tag for search_fragment is invalid. Received: layout-sw320dp/search_fragment_0

Basically same question: Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0

0 Answers
Related