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

2

11

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?

Aggress answered 8/1, 2015 at 23:36 Comment(4)
assembleRelease signs the app - what additional steps are you doing to the final APK?Wellchosen
After signing the app, it needs to be zipaligned and then uploaded to a server.Aggress
Hi , have you found the way to specify an output location upon assembling with terminal ?Lamdin
Take a look here: #22833797Mott
D
2

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.

Degauss answered 8/6, 2016 at 5:26 Comment(1)
where can he get output path? If you know the answer you are welcome to answer my similar question hereEmbodiment
D
1

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;
}
Demitria answered 19/11, 2018 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.