I have this strange behaviour where on my Samsung Galaxy I get this bug where it can't find the class R$styleable
. When I run the same code on my Nexus 5 or Nexus 4 I don't get the problem and everything works fine.
The line where I get this exception is in my custom Spinner
implementation ImageSpinner
:
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ImageSpinner);
This is the exception I get:
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package.name/my.package.name.NavigationSetupActivity}: android.view.InflateException: Binary XML file line #39: Error inflating class my.package.name.views.ImageSpinner
Caused by: java.lang.NoClassDefFoundError: my.package.name.R$styleable
This is the stylable file located in the values/attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ImageSpinner">
<attr name="arrowTint" format="color" />
<attr name="hideArrow" format="boolean" />
</declare-styleable>
</resources>
The OS version of the Samsung Galaxy phone is 4.2.2 (CyanogenMod) but also on stock Samsung Android OS it crashes. The Nexus 5 is 6.0.1 and Nexus 4 is a lollipop version. Thhe sdk tools and compile version are following:
compileSdkVersion 23
buildToolsVersion '23.0.2'
minSdkVersion 16
targetSdkVersion 23
I tried to clean the project and check the resource files and everything seems to be ok, but I really have no more ideas how to approach this problem. Does anyone have an idea how to fix this?
Thank you for your time!