title: Resources$NotFoundException when using multidex on kitkat
body: <p>I have this app which requires multidex and it is working fine on lollipop but when I run it under kitkat it gives me a <code>Resources$NotFoundException</code></p>
  
  <p>My gradle config is:</p>
  
  <pre><code>defaultConfig {
          targetSdkVersion 21
          minSdkVersion 15
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
  
      }
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
  
      //multidex
      compile 'com.android.support:multidex:1.0.0'
  
      //my own libs
      compile project(':mylibrarywiththatresource')
  
     }
  </code></pre>
  
  <p>My <code>Application</code> class extends <code>MultiDexApplication</code>.</p>
  
  <p>And here is the exception:</p>
  
  <pre><code>02-11 16:06:40.705    3609-3609/mypackage W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x416f2da0)
  02-11 16:06:40.825    3609-3609/mypackage E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: mypackage, PID: 3609
      java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackage/mypackage.ui.ServerListActivity}: android.view.InflateException: Binary XML file line #43: Error inflating class mypackage.ui.MiniController
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
              at android.app.ActivityThread.access$900(ActivityThread.java:169)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:146)
              at android.app.ActivityThread.main(ActivityThread.java:5487)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: android.view.InflateException: Binary XML file line #43: Error inflating class mypackage.ui.MiniController
              at android.view.LayoutInflater.createView(LayoutInflater.java:626)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at mypackage.ui.ServerListActivity.onCreate(ServerListActivity.java:39)
              at android.app.Activity.performCreate(Activity.java:5451)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
              at android.app.ActivityThread.access$900(ActivityThread.java:169)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:146)
              at android.app.ActivityThread.main(ActivityThread.java:5487)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.reflect.InvocationTargetException
              at java.lang.reflect.Constructor.constructNative(Native Method)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at android.view.LayoutInflater.createView(LayoutInflater.java:600)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at mypackage.ui.ServerListActivity.onCreate(ServerListActivity.java:39)
              at android.app.Activity.performCreate(Activity.java:5451)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
              at android.app.ActivityThread.access$900(ActivityThread.java:169)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:146)
              at android.app.ActivityThread.main(ActivityThread.java:5487)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class &lt;unknown&gt;
              at android.view.LayoutInflater.createView(LayoutInflater.java:626)
              at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
              at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at mypackage.ui.MiniController.&lt;init&gt;(MiniController.java:38)
              at java.lang.reflect.Constructor.constructNative(Native Method)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at android.view.LayoutInflater.createView(LayoutInflater.java:600)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at mypackage.ui.ServerListActivity.onCreate(ServerListActivity.java:39)
              at android.app.Activity.performCreate(Activity.java:5451)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
              at android.app.ActivityThread.access$900(ActivityThread.java:169)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:146)
              at android.app.ActivityThread.main(ActivityThread.java:5487)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.reflect.InvocationTargetException
              at java.lang.reflect.Constructor.constructNative(Native Method)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at android.view.LayoutInflater.createView(LayoutInflater.java:600)
              at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
              at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at mypackage.ui.MiniController.&lt;init&gt;(MiniController.java:38)
              at java.lang.reflect.Constructor.constructNative(Native Method)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at android.view.LayoutInflater.createView(LayoutInflater.java:600)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at mypackage.ui.ServerListActivity.onCreate(ServerListActivity.java:39)
              at android.app.Activity.performCreate(Activity.java:5451)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
              at android.app.ActivityThread.access$900(ActivityThread.java:169)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:146)
              at android.app.ActivityThread.main(ActivityThread.java:5487)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: android.content.res.Resources$NotFoundException: File res/drawable/border_all_around.xml from drawable resource ID #0x7f02003d
              at android.content.res.Resources.loadDrawable(Resources.java:3066)
              at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
              at android.view.View.&lt;init&gt;(View.java:3708)
              at android.view.View.&lt;init&gt;(View.java:3638)
              at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:474)
              at android.widget.RelativeLayout.&lt;init&gt;(RelativeLayout
  </code></pre>
  
  <p>So what am I doing wrong?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: This is where it crashes:</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity  {
  ....
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity);
  </code></pre>
  
  <p>On the setContentView. </p>
  
  <p>EDIT: Adding more of the gradle file:</p>
  
  <pre><code>productFlavors {
          // Define separate dev and prod product flavors.
          dev {
              // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
              // to pre-dex each module and produce an APK that can be tested on
              // Android Lollipop without time consuming dex merging processes.
              minSdkVersion 21
          }
          prod {
              // The actual minSdkVersion for the application.
              minSdkVersion 15
          }
      }
  
  
  
  buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  </code></pre>
  
  <p>EDIT: I should mention I am not on Android Studio 1.1 rc1 and still having the issue. </p>
  
  <p>EDIT: If I remove the use of the drawable that it is complaining about then it works fine. This is the drawable:</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
         android:shape="rectangle"&gt;
      &lt;stroke
              android:width="1dip"
              android:color="@color/ib_light_gray" /&gt;
      &lt;solid android:color="?attr/colorPrimary"&gt;&lt;/solid&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>And it is used like this in a layout file (mini controller) in the same module:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="48dp"
      android:paddingTop="10dp"
      android:paddingBottom="10dp"
      android:background="@drawable/border_all_around"&gt;
  </code></pre>
  
  <p>That layout file is part of a custom View that I use on my main module main activity layout like this:</p>
  
  <pre><code> &lt;mypackage.ui.MiniController
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/mini_controller"
                  android:visibility="gone"
                  android:layout_alignParentBottom="true"
                  &gt;
  
              &lt;/mypackage.ui.MiniController&gt;
  </code></pre>
  
  <p>EDIT: Figured out the issue. Since it was the background causing it, I tried setting the background in the View instantiation instead of in xml and it gave me this error <code>java.lang.UnsupportedOperationException: Can't convert to color: type=0x2</code> which told me there was an issue with a color so I replaced <code>&lt;solid android:color="?attr/colorPrimary"&gt;&lt;/solid&gt;</code> with a different color and it worked. </p>