Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying output location when assembling an Android project with Gradle via Terminal?

I'm trying to automate the build and upload process for a signed APK of an Android app without using Android Studio, so I'm running everything in Terminal. The first command is:

./gradlew assembleRelease

Which generates an unsigned, unaligned APK in the /APP NAME/build/outputs/apk folder. However, since APP NAME won't be the same for every app, I can't just hard code the location of the output file into the next step of signing it. Are there any arguments I can use with the gradlew command to specify an output directory and file name of my choice?

like image 454
Jordan Kizer Avatar asked Jan 08 '15 23:01

Jordan Kizer


2 Answers

There is no such command to specify the output.But you can write a script to make this possible.As you have got the /build/outputs/app-release.apk, you can copy and rename it to everywhere you want.

like image 185
Kyeson Avatar answered Sep 23 '22 18:09

Kyeson


you can dynamically append some script to that build file(build.gradle) to set the buildDir of any project.

for example:

allprojects {
  buildDir = System.properties['user.home']+"/"+project.name;
}
like image 35
fatfatson Avatar answered Sep 22 '22 18:09

fatfatson