android custom view attributes not working after switch to gradle <p>so I recently migrated to gradle now my custom view attributes return null</p> <p>my project looks like this</p> <p>--custom_icon_view // library that holds the custom view with custom attributes --my application // this is the main app that actually uses the custom view</p> <p>in my layout I have the namespace defined like this :</p> <pre><code> xmlns:iconview="http://schemas.android.com/lib/be.webelite.iconview" </code></pre> <p>because using apk/res-auto retuns an error saying attibutes could not be identified</p> <p>this is how I try to get the icon name defined in xml, this used to work perfectlly but now it doesnt. and all I changed was migrating to gradle.</p> <pre><code> final TypedArray a = context.obtainStyledAttributes(attrs,be.webelite.iconview.R.styleable.icon); icon_name = a.getString(be.webelite.iconview.R.styleable.icon_name); </code></pre> <p>so I'm guessing my gradle.build files are causing a problem?</p> <p>I have the library set to </p> <pre><code> apply plugin: 'android-library' </code></pre> <p>end the main app gradle.build as </p> <pre><code> apply plugin: 'android' </code></pre> <p>this has been giving me headache for 2 days now :( any help/hints are very apperciated.</p> <p>here are my gradle files</p> <p><a href="http://pastie.org/private/h57o8nanydosq0dtm6eiq">http://pastie.org/private/h57o8nanydosq0dtm6eiq</a></p> <p>and here is the folder structure</p> <p><a href="http://pastie.org/private/nvbzomx2zeagdpzt8qqjsq">http://pastie.org/private/nvbzomx2zeagdpzt8qqjsq</a></p> <p>this is how I declare my view in the xml</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" &lt;!-- tried res-auto didn't work --&gt; xmlns:iconview="http://schemas.android.com/apk/lib/be.webelite.iconview" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_gray"&gt; &lt;be.webelite.iconview.IconView android:layout_width="wrap_content" android:layout_height="wrap_content" iconview:icon_name="entypo_search" android:textSize="25dp"/&gt; </code></pre> <p>attrs.xml in IconView>res>values directory</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;declare-styleable name="icon"&gt; &lt;attr name="name" format="string" /&gt; &lt;/declare-styleable&gt; &lt;/resources&gt; </code></pre>