title: Android studio uses wrong file path to apk when I use custom build.gradle file
body: <p>So Im trying to use a custom build file that generates an unsigned apk then runs a task on it and then zipaligns it. I havent gotten that working yet. However I do have it creating and properly signing the apk but when I try to just push the play button to run it in debug on a device using my custom debug set up studio/gradle generates my apk and places it in the directory I want but it fails to push it on to the device because it uses a file path that doesnt exist. 
  I/O Error: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Android Studio\apk\V2.5-10-debug-20140922-2335.apk (The system cannot find the path specified). Is this hard coded into the studio build because I cant find a setting to change it. Its really making the whole process a real pain lol. Infact that path doesnt exist anywhere on my machine.</p>
  
  <p><b>EDIT</b>  heres my build.gradle file</p>
  
  <pre><code>import java.text.SimpleDateFormat
  import java.util.regex.Pattern
  
  apply plugin: 'com.android.application'
  
  
  def buildTime() {
      def df = new SimpleDateFormat("yyyyMMdd'-'HHmm")
      df.setTimeZone(TimeZone.getDefault())
      return df.format(new Date())
  }
  
  def apkName = "MyApp"
  def apkLocation
  
  task (runApkSigTool , dependsOn: android, type: JavaExec) {
  
      classpath files('apksigtool.jar')
      main 'com.widevine.tools.android.apksigtool.ApkSigTool'
      args[0] = apkLocation
      args[1] = 'private_key.der'
      args[2] = 'my.crt'
      System.out.println(apkLocation);
  }
  
  
  
  android {
      compileSdkVersion 19
      buildToolsVersion "19.1.0"
  
  
  signingConfigs{
  
      debug{
          storeFile file("debug.keystore")
          storePassword "android"
          keyAlias "androiddebugkey"
          keyPassword "android"
  
      }
  
      release{
          storeFile file("debug.keystore")
          storePassword "android"
          keyAlias "androiddebugkey"
          keyPassword "android"
  
      }
  
  }
  
  
  buildTypes {
  
      debug{
  
      }
  
      release {
  
      signingConfig signingConfigs.release
      runProguard false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  
      assembleDebug.doLast{
         runApkSigTool.execute()
      }
  
      zipAlign true
  
  }
  
  debug{
  
      signingConfig signingConfigs.debug
      runProguard false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  
      assembleDebug.doLast{
          runApkSigTool.execute()
      }
  
      zipAlign false
  
  }
  
  
  android.applicationVariants.all { variant -&gt;
  
      def manifestFile = file("C:\\path\\app\\src\\main\\AndroidManifest.xml")
      def pattern = Pattern.compile("versionName=\"(.+)\"")
      def manifestText = manifestFile.getText()
      def matcher = pattern.matcher(manifestText)
      matcher.find()
      def versionName = matcher.group(1)
      pattern = Pattern.compile("versionCode=\"(.+)\"")
      matcher = pattern.matcher(manifestText)
      matcher.find()
      def versionCode = matcher.group(1)
  
      if (variant.zipAlign) {
          variant.outputFile = new File("apk/"+apkName+"-V"+versionName+"-"+versionCode+"-"+variant.name+"-"+buildTime()+"-unaligned.apk");
          variant.zipAlign.inputFile = variant.outputFile
          variant.zipAlign.outputFile = new File("apk/"+apkName+"-V"+versionName+"-"+versionCode+"-"+variant.name+"-"+buildTime()+".apk");
      } else {
  
          apkLocation = "apk/"+apkName+"-V"+versionName+"-"+versionCode+"-"+variant.name+"-"+buildTime()+".apk";
          variant.outputFile = new File("apk/"+apkName+"-V"+versionName+"-"+versionCode+"-"+variant.name+"-"+buildTime()+".apk");
  
          System.out.println("CREATED UNSIGNED APK---------------")
  
      }
  
  }
  
  }
  lintOptions {
      abortOnError false
      ignoreWarnings true
      checkAllWarnings false
   }
  
  
  
  }
  
  dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:20.0.0'
  compile 'com.android.support:mediarouter-v7:20.0.0'
  compile 'com.google.android.gms:play-services:5.0.89'
  }
  </code></pre>