title: Copy APK file from build location to some other location in gradle 4.4
body: <p>As in <code>gradle</code> <code>4.4</code> it is not possible to change path of APK output file and we can't use absolute path for the apk's output now from the docs -  <a href="https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration#variant_output" rel="nofollow noreferrer"><strong>Modifying variant outputs at build time may not work</strong></a> so I searched on SO and found a solution that we can copy <code>apk</code> to our desired location after it gets build but I don't have much idea on gradle scripting and i am not able to call copy task. Can anyone help me. </p>
  
  <p>code from my gradle :</p>
  
  <pre><code>    android {
      ................
      android.applicationVariants.all { variant -&gt;
      variant.outputs.all {
          if (variant.name.contains("Release")) {
               outputFileName = "${variant.name}-${variant.versionName}.apk"
          }
       }
       assembleRelease {
          dependsOn copyDocs
      }
      }// end of android brace
  
      task copyApk(type: Copy) {
      from outputFileName
      into file("${project.buildDir}/outputs/apk")
     }
    }
  </code></pre>
  
  <p>From this way i am getting error :</p>
  
  <blockquote>
    <p>Could not get unknown property 'outputFileName' for task</p>
  </blockquote>
  
  <p>Any idea how to copy apk file to another path? Thanks.</p>