title: :app:compileDebugJava Failed when using android studio
body: <p>In don't quite understand why this is failing to compile.  When i compile and run the same source code from Eclipse, it compiles and runs perfectly fine.  But under Android Studio and Gradle, it just falls apart.</p>
  
  <p>Below is my build.gradle</p>
  
  <pre><code>apply plugin: 'android'
  
  
  def versionMajor = 1
  def versionMinor = 0
  def versionPatch = 0
  def versionBuild = 0
  
  android {
      compileSdkVersion 19
      buildToolsVersion '19.0.1'
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_7
          targetCompatibility JavaVersion.VERSION_1_7
      }
  
      sourceSets {
  
          main {
              manifest.srcFile 'src/main/AndroidManifest.xml'
              java.srcDirs = ['src/main/java']
              res.srcDirs = ['src/main/res']
              jni.srcDirs = []
              resources.srcDirs = ['src/main/res']
              jniLibs.srcDirs = ['src/main/libs']
          }
          instrumentTest {
              java.srcDirs = ['src/instrumentTest/java']
          }
      }
  
      /*
      productFlavors {
          playstore {
              packageName '&lt;package name&gt;'
          }
          amazonappstore {
              packageName '&lt;package name&gt;'
          }
          samsungstore {
              packageName '&lt;package name&gt;'
          }
      }*/
      defaultConfig {
          minSdkVersion 14
          targetSdkVersion 19
  
          versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
          versionName "${versionMajor}.${versionMinor}.${versionPatch}"
  
          ndk{
              abiFilter "all"
          }
      }
      buildTypes {
  
          //build type 3
          release {
              debuggable false
              jniDebugBuild false
              runProguard false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
  
              applicationVariants.all { variant -&gt;
                  def file = variant.outputFile
                  variant.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
              }
  
          }
      }
      //TASKS
      tasks.withType(com.android.build.gradle.tasks.PackageApplication){
          pkgTask -&gt; pkgTask.jniFolders = [new File(projectDir, "libs")]
      }
  
      task ndkBuild(type:Exec){
          logger.info('ndkBuild Configuration')
          def ndkBuild;
          def ndkBuildingDir = new File("src/main");
          def hasNdk = false;
          logger.info('Project Path: ' +projectDir)
          logger.info('JNI Path: ' +ndkBuildingDir)
  
          if (System.env.ANDROID_NDK_HOME != null) {
              hasNdk = true;
              ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build')
          }
          else
          {
              //if  env variable is not defined then do this
              def Properties localProps = new Properties()
              localProps.load(new FileInputStream(file('../local.properties')))
              if (localProps['ndk.dir'] !=null)
              {
                  hasNdk = true;
                  ndkBuild = new File(localProps['ndk.dir'], 'ndk-build')
              }
          }
  
          commandLine ndkBuild, "--directory", ndkBuildingDir
  
  
          doFirst {
              if (!hasNdk) {
                  logger.error("Failed NDK build")
              }
              assert hasNdk : "ANDROID_NDK_HOME not set."
          }
      }
  
      task copyNativeLibs(type: Copy, dependsOn: "ndkBuild") {
          logger.error("Path is"+buildDir);
          from(new File('src/main/libs')) { include '**/*.so' }
          into new File(buildDir, 'native-libs')
      }
  
      tasks.withType(JavaCompile) {
          compileTask -&gt; compileTask.dependsOn ndkBuild
      }
  }
  
  dependencies {
      compile 'com.android.support:support-v4:19.0.1'
      compile 'com.android.support:appcompat-v7:+'
      compile fileTree(dir: 'libs', include: ['*.jar'])
  }
  </code></pre>
  
  <p>Here is few of the error messages</p>
  
  <pre><code>:app:ndkBuild                 
  JNI LOCATION: jni             
  MAKE_FILE_LOCATION:           
  ZLIB Compiled                 
  libpng compiling              
  make: Entering directory `/Users/vikramsahai/Documents/workspace/SVS-ANDROID/SVS/app/src/main'
  Install        : libharu.so =&gt; libs/armeabi/libharu.so
  make: Leaving directory `/Users/vikramsahai/Documents/workspace/SVS-ANDROID/SVS/app/src/main'
  :app:compileDebugJava 
  cast to Object for a varargs call   
  /Users/vikramsahai/Documents/workspace/SVS-ANDROID/SVS/app/src/main/java/com/vikramsahai/apps/finance/CPDF.java:255: error: cannot access Color
                  a1.setBackgroundColor(new BaseColor(0xD4D4D4));
                                        ^
    class file for java.awt.Color not found
    cast to Object[] for a non-varargs call and to suppress this warning
  /app/src/main/java/com/vikramsahai/apps/finance/db/Database.java:329: warning: non-varargs call of varargs method with inexact argument type for last parameter;
                                                  initialValues.put(f.getName().substring(1, f.getName().length()), String.valueOf(m.invoke(obj, null))); 
  </code></pre>
  
  <p>It doesn't make sense why it would compile and run on eclipse and yet fall apart on Android Studio/Gradle</p>
  
  <p>The top level build.gradle has this dependency</p>
  
  <pre><code>dependencies {
      classpath 'com.android.tools.build:gradle:0.8.+'
  }
  </code></pre>