Android how build more then one release variant? - visual-studio-app-center

I have an Android app that is white label, I am trying to understand how to build on the same agent process more than one variant
in my terminal, I do something like that to build,
./gradlew assembleABCRelease &&
./gradlew assembleDEFRelease &&
./gradlew assembleGHIRelease
Is it possible to do it in APP-CENTER?

Related

android studio error - Could not determine the dependencies of task ':app:installDebug'

While running the React Native Android app, then building the project the following error is shown:
Could not determine the dependencies of task ':app:installDebug'.
Go to android folder in your project and then type
gradlew clean for Windows and
./gradlew clean for Mac and Linux. I use this method every time I encounter the same problem, and also when changing the package.json (add / remove library)
Please remove build folder in /android/app and run build command again.
It worked for me.

Run a shell script before a gradle build in Android Studio?

Is it possible to run a unix shell script in Android Studio before every (gradle) build?
I'm having some trouble with gradle builds taking forever and one (admittedly bad) solution that works is to kill all java processes if they hold more than say 6Mb memory.
What I would like to do is run a shell script that does that before every build in Android Studio.
I'm not looking to add a gradle task to run before my build. That won't work because if I kill all java processes, gradle will also be killed.
So again:
Can I set up Android Studio (or gradlew) to run a script before building?
Instruction for Intellij Idea, but I hope it works for Android Studio
Edit configirations...
Select\create run configuration for gradle build. Add "before launch" option
Select ptoper option. For example - "Run external tool"

How can I build the apk from android studio from flutter

now I'm making an app using flutter and trying to upload the app as internal test on Google play store. I saw people asking how to do it, but could not figure it out...
On the official document, it says "Build > Build > Generate Signed Bundle/APK" and I can generate APK, but I don't see the "Generate Signed Bundle/APK".
When I select "Build APK" in the picture above, it gives me the message like
You are building a fat APK that includes binaries for android-arm,
android-arm64, android-x64. If you are deploying the app to the Play
Store, it's recommended to use app bundles or split the APK to reduce
the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
27.9s ✓ Built build/app/outputs/apk/release/app-release.apk (19.2MB). Process finished with exit code 0
Also, I saw this chat (How to build signed apk from Android Studio for Flutter), but I cannot see "open android module in android studio"
Even when I opened the android project with different window, I cannot see the option as well..
it will be really helpful if someone can teach me how to generate the APK from my current situation...
Thank you so much..
The reason why Open Android module in Android Studio is missing under Tools > Flutter is likely because you're using an older version of Flutter DevTools on Android Studio. You can run flutter pub global activate devtools on the Terminal to update the DevTools installed on the machine as mentioned on this guide.
to build apk use this line in terminal
flutter build apk --release --no-sound-null-safety

Flutter How to make release version in Android Studio?

By default Android Studio use debug mode when building Flutter application. You can build the release version with the command line, see How to optimize the Flutter App size?
flutter build apk --release
Now: how to configure Android Studio to do the same, when I run the application (Shift+F10)? I can't find this setting...
You have to edit the run configuration:
Open the run configuration:
Add the --release flag:
Note that using the --release flag is not supported when you build with the Android Emulator.
In Android Studio , click on :
> Run
> Flutter Run 'main.dart' in Release Mode
flutter build appbundle --release --build-name=1.1.1 --build-number=3
Or you can run that in your Terminal, Remember to change build name and build number to corresponding values of your release app versioning.
as the green play button in toolbar runs the debug mode, i switched it to release mode via:
Right click Play Icon in toolbar -> Customize Toolbar
click "+", chose Add Action
chose "Plugins/Flutter/Run in Flutter release mode"
Delete the old Play button by selecting it and click "-"
The best way to make your apk for release mode is that open the project -> click on the android folder then make your apk as same as generated application build in android using your .jks key and alias password and name. this is the correct way for making apk in flutter.

Android Studio 3 does not run tests in Spock

I updated Android Studio to version 3 and since then all my spock tests, when in a java module, do not run when trying to run them from inside the application (right click on groovy folder -> Run 'Tests in groovy'). I get a:
Class not found: "package.name.classname"Empty test suite."
Same if I try to run a single test.
If I run the test task from the gradle panel I get this:
error. Cause: unknown.
On the other hand:
Any spock tests in android modules run fine.
All my java tests in all my modules run fine.
All my tests (spock and java) run fine when running them from outside AS using gradle (gradlew clean test).
My setup:
gradle v4.1
android gradle plugin v3.0.0
java version compatibility v1.8
in my java modules i use the gradle groovy plugin
in my android modules i use the groovy android gradle plugin
A few things I tried after searching in both google and here:
changing the android gradle plugin back to v2.3.3 and gradle to v3.3
trying to copy all groovy classes to build/classes/java/test
So this is more of a workaround than an actual solution but it should give you your debugger back which is probably 90% of the value anyway:
You can run your test suite like:
./gradlew <module>:test --debug-jvm
And the jvm running your tests will suspend until a debugger attaches.
From Android Studio bring up the action chooser by pressing ctrl + shift + a (on linux anyway, check the equivalent for your OS) and select:
Attach to local process...
Once Android Studio attaches the tests will begin running.
The --debug-jvm flag can be used together with --tests to debug an individual test:
./gradlew <module>:test --tests fully.qualified.test.Test --debug-jvm

Resources