Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Expected resource of type styleable [ResourceType] error

Take a look at this code snippet. I am getting an error with the last line, because I am passing an 'index' instead of a resource. I thought it was a lint issue and tried to suppress it. Then I noticed I am getting this error only when I building for release. It works fine when building for debug. I am totally clueless. Can anyone throw some light into what I am doing wrong.

//Get paddingLeft, paddingRight         int[] attrsArray = new int[]{                 android.R.attr.paddingLeft,  // 0                 android.R.attr.paddingRight, // 1         };         TypedArray ta = context.obtainStyledAttributes(attrs, attrsArray);         if (ta == null) return;         mPaddingLeft = ta.getDimensionPixelSize(0, 0);         mPaddingRight = ta.getDimensionPixelSize(1/*error here*/, 0);  
like image 992
Codevalley Avatar asked Mar 28 '16 02:03

Codevalley


1 Answers

I had the same issue when trying to build a signed apk. Solved it by adding @SuppressWarnings("ResourceType") to suppress the warning, now it works fine.

like image 83
Joe3112 Avatar answered Sep 21 '22 05:09

Joe3112