Click here to Skip to main content
15,946,342 members
Home / Discussions / Android
   

Android

 
QuestionWhat is the right technique to automate Android builds from command line with gradlew command? Pin
Prahlad Yeri14-Jun-24 5:42
Prahlad Yeri14-Jun-24 5:42 
I want to build my Android Studio project from command line as opening it consumes too much RAM. Besides, my app is "WebView heavy", most of the work happens in HTML/JS/CSS inside of the webview, so it makes sense to build the APK/AAB directly from command line for testing. So far, I'm able to generate bunlde with the below command after setting the JAVA_HOME to \path\to\android-studio\jre\jre

gradlew bundle

However, this generates only the bundle file (*.aab) and that too the unsigned or debug version. What I want to generate is:
  1. Signed *.aab to release on Play Store.
  2. Unsigned *.apk for testing.
When I list the tasks using gradlew tasks command, it gives me the below. What should I do to achieve these objectives? I already tried some other tasks (build and assemble) as parameters but they result in error.

EDIT: OK, found some helpful information here. The second one (debug APK) I managed with the assembleDebug task. The first one (signing the aab) is still a constraint.
> Task :tasks

<hr />

<h2>Tasks runnable from root project</h2>

<h2>Android tasks</h2>

androidDependencies - Displays the Android dependencies of the project.
signingReport - Displays the signing info for the base and test modules
sourceSets - Prints out all the source sets defined in this project.

<h2>Build tasks</h2>

assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
bundle - Assemble bundles for all the variants.
clean - Deletes the build directory.
cleanBuildCache - Deletes the build cache directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources

<h2>Build Setup tasks</h2>

init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

<h2>Cleanup tasks</h2>

lintFix - Runs lint on all variants and applies any safe suggestions to the source code.

<h2>Help tasks</h2>

buildEnvironment - Displays all buildscript dependencies declared in root project 'Python MCQ'.
components - Displays the components produced by root project 'Python MCQ'. [incubating]
dependencies - Displays all dependencies declared in root project 'Python MCQ'.
dependencyInsight - Displays the insight into a specific dependency in root project 'Python MCQ'.
dependentComponents - Displays the dependent components of components in root project 'Python MCQ'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'Python MCQ'. [incubating]
projects - Displays the sub-projects of root project 'Python MCQ'.
properties - Displays the properties of root project 'Python MCQ'.
tasks - Displays the tasks runnable from root project 'Python MCQ' (some of the displayed tasks may belong to subprojects).

<h2>Install tasks</h2>

installDebug - Installs the Debug build.
installDebugAndroidTest - Installs the android (on device) tests for the Debug build.
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build.
uninstallDebugAndroidTest - Uninstalls the android (on device) tests for the Debug build.
uninstallRelease - Uninstalls the Release build.

<h2>Verification tasks</h2>

check - Runs all checks.
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
lint - Runs lint on all variants.
lintDebug - Runs lint on the Debug build.
lintRelease - Runs lint on the Release build.
lintVitalRelease - Runs lint on just the fatal issues in the release build.
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.

To see all tasks and more detail, run gradlew tasks --all

To see more detail about a task, run gradlew help --task <task>

BUILD SUCCESSFUL in 4s
1 actionable task: 1 executed


modified 14-Jun-24 12:44pm.

QuestionWhat is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
priyamtheone2-Mar-24 4:39
priyamtheone2-Mar-24 4:39 
AnswerRe: What is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
Richard Deeming3-Mar-24 22:03
mveRichard Deeming3-Mar-24 22:03 
GeneralRe: What is the correct syntax to call onCreateOptionsMenu() and onPrepareOptionsMenu() in Android Studio? Pin
priyamtheone30-Mar-24 7:39
priyamtheone30-Mar-24 7:39 
QuestionWeb browser design home page Pin
Bibek Poudel Nov202319-Nov-23 20:32
Bibek Poudel Nov202319-Nov-23 20:32 
AnswerRe: Web browser design home page Pin
Dave Kreskowiak20-Nov-23 3:19
mveDave Kreskowiak20-Nov-23 3:19 
GeneralRe: Web browser design home page Pin
David Crow7-Feb-24 2:18
David Crow7-Feb-24 2:18 
QuestionThe user data that I enter are not insert into the Firebase Realtime Database. Pin
alia zulaika4-Oct-23 22:45
alia zulaika4-Oct-23 22:45 
QuestionBuilding an ecommerce app/website Pin
Ben A Johnson24-Apr-23 4:07
Ben A Johnson24-Apr-23 4:07 
AnswerRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 4:14
mveRichard MacCutchan24-Apr-23 4:14 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 4:42
Ben A Johnson24-Apr-23 4:42 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 4:49
mveRichard MacCutchan24-Apr-23 4:49 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson24-Apr-23 6:26
Ben A Johnson24-Apr-23 6:26 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan24-Apr-23 6:29
mveRichard MacCutchan24-Apr-23 6:29 
AnswerRe: Building an ecommerce app/website Pin
jschell25-Apr-23 11:07
jschell25-Apr-23 11:07 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson25-Apr-23 20:47
Ben A Johnson25-Apr-23 20:47 
GeneralRe: Building an ecommerce app/website Pin
jschell26-Apr-23 6:10
jschell26-Apr-23 6:10 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson27-Apr-23 23:32
Ben A Johnson27-Apr-23 23:32 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan27-Apr-23 23:35
mveRichard MacCutchan27-Apr-23 23:35 
GeneralRe: Building an ecommerce app/website Pin
Ben A Johnson28-Apr-23 1:55
Ben A Johnson28-Apr-23 1:55 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 2:02
mveRichard MacCutchan28-Apr-23 2:02 
GeneralRe: Building an ecommerce app/website Pin
jschell28-Apr-23 11:17
jschell28-Apr-23 11:17 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan28-Apr-23 20:55
mveRichard MacCutchan28-Apr-23 20:55 
GeneralRe: Building an ecommerce app/website Pin
David Crow29-Apr-23 11:48
David Crow29-Apr-23 11:48 
GeneralRe: Building an ecommerce app/website Pin
Richard MacCutchan29-Apr-23 22:03
mveRichard MacCutchan29-Apr-23 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.