Error: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
You need to define your dimensional resources as dimens not strings. So, move your @string/marginbutton
from strings.xml to res/values/dimens.xml as
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen
name="marginbutton">8dp</dimen>
</resources>
Your error basically complains about passing a <string>
resource where a <dimen>
is expected.