How to generate android app bundle from jenkins job - android

I have generate apk from jenkins job and publishing it to google playstore. Now i need to generate android app bundle from jenkins job. Please guide to generate aab from jenkins job. Thanks!

You can configure your jenkins job to invoke a gradle build script.
Use the gradle task (to build the release variant)
./gradlew bundleRelease
More info in the official doc.

Related

Can't generate Signed Bundle on Android Studio

How can I generate a signed bundle?
I want to upload a signed app bundle of Flutter project to Google Play.
Environment
What I did
Go to Build > Flutter > Build App Bundle
Create an aab file and upload it to Google Play.
Get this message: "You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode."
Go to this page (https://developer.android.com/studio/publish/app-signing#signing-manually)
Find this instruction: "click Build > Build > Generate Signed Bundle/APK".
However, I don't find "Generate Signed Bundle/APK" in "build". (I got stuck here.)
You should open android folder of your flutter project in android studio. Not root directory.
In order to sign Android apps written in Flutter, you can follow Flutter's signing method which can be used with flutter command line interface. If build.gradle is configured correctly, you can use flutter build appbundle (considering you want to generate an appbundle, not an apk) to generate an appbundle. Take a look at this page for detailed information.
You need to click on Build->Generate Signed APK/Bundle in the android studio. Even the DEBUG applications get signed with a DEBUG Key for the purpose for testing by the developers on emulators or real devices by installing it through ADB.

Build android bundle along with apk with one command

If using Android Gradle Plugin version 3.4.2 or prior the command ./gradlew bundleRelease will generate both bundle and apk of the app. But after upgrading to 3.5 version it generates only the bundle.
Is it possible to get the former behaviour, by means of some configuration or adding some parameters to the command?
It was convenient to have both apk and bundle with one command earlier (the bundle is being uploaded to Google Play, whereas the apk is being uploaded to the Beta by Crashlytics). Now I need to add another step ./gradlew assembleRelease and it takes longer to execute them both.
Finally after some hit and trials, I found that we can run multiple actions in one line command.
Like here I am doing a clean first and then creating a bundle and an apk -
gradlew clean bundleFlavorBuildType assembleFlavorBuildType
where Flavor is flavor name and BuildType is release/debug/custom buildType. If you want to build both release and debug apk & aab. e.g. flavor is chocolate
gradlew clean bundleChocolate assembleChocolate
This will output chocolate-relase & chocolate-debug aab, apk both.

How to create aab instead of apk from Jenkins

I want to configure my personal app to be built as an android app bundle rather than apk in Jenkins. How do I configure my Jenkins to build aab and not apk
You need BundleTool You can use bundletool to create an aab and sign it and even test it.
You can install Bundletool just like another CLI utility and execute commands in Jenkins.
Or you can just execute a Gradle task like bundleRelease to generate your release aab.
Here is much detailed on how to do so.
https://developer.android.com/studio/build/building-cmdline#bundletool-build
https://developer.android.com/studio/command-line/bundletool

Updating apk SHA1 differs even after using same keystore

I have uploaded my app to Goggle Play few months back after signing it with a release keystore, I have stored that Keystore for future updation. Now I have updated the apk with some changes, while trying to upload the new apk signed with same keystore along with same alias and password, the apk is not allowed to upload to Goggle Play.
Playstore shows me following error :
The only change is, earlier the appication was developed and build using eclipse and now in android studio Can this be the reason for showing the above error???
From the error message I would say you have mixed up the keystores, or android studio is just using the wrong one to do the release build. The best way to be completely sure is to clearly setup your build.gradle, and build it yourself on the command line using
./gradlew clean assembleRelease
What is probably happening is that Android Studio is using your debug keystore (ie. the default) to sign the release build because it can't find the original keystore you used in eclipse, or you have the wrong password somewhere...
Have a look at this configuration, note the location of the keystores, the naming convention and how it corresponds to the build.gradle. Note the signingconfigs and how they are setup for the release build. To build from the command line, simply cd into the directory with your "gradlew" file, and run
./gradlew clean assembleRelease
to build the release apk, or
./gradlew clean assembleDebug
to build the debug apk. If it fails, try
./gradlew clean assembleRelease --stacktrace
Screenshot of build.gradle and filesystem setup
But please remember not to put your keys in your source control! That means editing your .gitignore file.
There is a stack of information on how to do this here:
http://developer.android.com/tools/publishing/app-signing.html

How can I deploy a release signed apk to attached device using gradle?

I have a keystore file with two keys: one for debug build and another for release build type. So my gradle build script generates two apks on need. Now, to deploy the debug build apk android gradle plugin has installDebug task in it but how about deploying the release build apk? Andorid gradle plugin doesn't have any task like installRelease. How can I deploy the release build apk directly to the connected devices using gradle?
The Android Gradle Plugin already includes the installRelease task but if you don't see it probably there is a signing configuration problem.
From the documentation:
Finally, the plugin creates install/uninstall tasks for all build
types (debug, release, test), as long as they can be installed (which
requires signing).
You can try to figure out what's wrong with the signingReport task:
./gradlew signingReport

Categories

Resources