title: Didn't find class "android.support.design.widget.CoordinatorLayout" using Buck
body: <p>I'm trying to get Buck working with the balnk application template from Android Studio. </p>
  
  <h3><code>apps/snappy/BUCK</code></h3>
  
  <pre><code>android_binary(
    name = 'main',
    manifest = 'AndroidManifest.xml',
    keystore = '//keystores:debug',
    package_type = 'debug',
    deps = [
      '//java:main',
      '//res:res',
      '//keystores:debug',
    ],
  )
  </code></pre>
  
  <h3><code>res/snappy/layout/activity_main.xml</code></h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.whitedrop.snappy.MainActivity"&gt;
  
      ....
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <h3><code>res/BUCK</code></h3>
  
  <pre><code>android_resource(
    name = 'res',
    res = 'snappy',
    package = 'com.whitedrop.snappy',
    deps = [
    '//libs:appcompat-v7',
    '//libs:design'
    ],
    visibility = [
      'PUBLIC',
    ]
  )
  </code></pre>
  
  <h3><code>libs/BUCK</code></h3>
  
  <pre><code>android_prebuilt_aar(
    name = 'appcompat-v7',
    aar = 'appcompat-v7-23.0.1.aar',
    visibility = ['PUBLIC']
  )
  android_prebuilt_aar(
    name = 'design',
    aar = 'design-23.0.1.aar',
    visibility = ['PUBLIC']
  )
  </code></pre>
  
  <h3>output</h3>
  
  <pre><code>                    Process com.whitedrop.snappy created for activity com.whitedrop.snappy/.MainActivity
                      PID: 2449   UID:    GIDs: 
  
  ActivityManager  I  Start proc 2449:com.whitedrop.snappy/u0a61 for activity com.whitedrop.snappy/.MainActivity
              art  I  Rejecting re-init on previously-failed class java.lang.Class&lt;android.support.design.widget.CoordinatorLayout&gt;
   AndroidRuntime  D  Shutting down VM
                   E  FATAL EXCEPTION: main
                   E  Process: com.whitedrop.snappy, PID: 2449
                   E  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whitedrop.snappy/com.whitedrop.snappy.MainActivity}: android.view.InflateExcept
                      ion: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
                   ...E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                   E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                   E  Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
                   E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
                   ....
                   E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                   E      ... 10 more
                   E  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data
                      /app/com.whitedrop.snappy-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
                   E      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                   ...
                   E      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
                   E      ... 19 more
                   E      Suppressed: java.lang.NoClassDefFoundError: android.support.design.widget.CoordinatorLayout
                   E          at dalvik.system.DexFile.defineClassNative(Native Method)
                   E ....     at dalvik.system.DexPathList.findClass(DexPathList.java:321)
                   E          at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                   E          ... 23 more
                   E      Suppressed: java.lang.ClassNotFoundException: android.support.design.widget.CoordinatorLayout
                   E          at java.lang.Class.classForName(Native Method)
                   E          at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                   E          at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                   E          at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                   E          ... 22 more
                   E      Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  ActivityManager  W    Force finishing activity 1 com.whitedrop.snappy/.MainActivity
  </code></pre>
  
  <p>EDIT: my apk contains the CoordinatorLayout class in its dex file btw</p>
  
  <p>EDIT2: full code can be found here <a href="https://github.com/vinz243/snappy" rel="nofollow">https://github.com/vinz243/snappy</a></p>
  
  <p>EDIT3: tried extending from AppCompatActivity:</p>
  
  <pre><code>vinz243@vm:~/snappy$ buck build app
  [-] PROCESSING BUCK FILES...FINISHED 0.1s [100%]
  [+] DOWNLOADING... (0.00 B/S, TOTAL: 0.00 B, 0 Artifacts)
  [+] BUILDING...0.3s [67%] (16/20 JOBS, 0 UPDATED, 0.0% CACHE MISS)
   |=&gt; IDLE
   |=&gt; IDLE
   |=&gt; //java:main...  0.2s (running javac[0.2s])
   |=&gt; IDLE
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:12: error: cannot access android.support.v4.app.TaskStackBuilder
  public class MainActivity extends AppCompatActivity {
         ^
    class file for android.support.v4.app.TaskStackBuilder not found
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:14: error: method does not override or implement a method from a supertype
      @Override
          ^
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:16: error: cannot find symbol
          super.onCreate(savedInstanceState);
                  ^
    symbol:   variable super
    location: class com.whitedrop.snappy.MainActivity
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:17: error: cannot find symbol
          setContentView(R.layout.activity_main);
                  ^
    symbol:   method setContentView(int)
    location: class com.whitedrop.snappy.MainActivity
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:20: error: method does not override or implement a method from a supertype
      @Override
          ^
  /home/vinz243/snappy/java/com/whitedrop/snappy/MainActivity.java:23: error: cannot find symbol
          getMenuInflater().inflate(R.menu.activity_main, menu);
                  ^
    symbol:   method getMenuInflater()
    location: class com.whitedrop.snappy.MainActivity
  Errors: 6. Warnings: 0.
  </code></pre>
  
  <p>Here is the MainActivity.java:</p>
  
  <pre><code>package com.whitedrop.snappy;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>EDIT 5:</p>
  
  <p>Fixed above error by adding support v4 to deps. Now I get when running:</p>
  
  <pre><code> E  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whitedrop.snappy/com.whitedrop.snappy.MainActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar
   E      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
   E  Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar
   E      at android.view.LayoutInflater.createView(LayoutInflater.java:633)
   E  Caused by: java.lang.reflect.InvocationTargetException
   E      at java.lang.reflect.Constructor.newInstance(Native Method)
   E      at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
   E      at android.view.LayoutInflater.createView(LayoutInflater.java:607)
   E      ... 24 more
   E  Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/graphics/drawable/VectorDrawableCompat;
   E      at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:891)
   E  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.graphics.drawable.VectorDrawableCompat" on path: DexPathList[[zip file
       "/data/app/com.whitedrop.snappy-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
   E      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  </code></pre>