Deploy on several emulators in android studio - android

I want to deploy on several emulator devices in android studio.
Just for testing it on different devices.
Is it possible?

Yes, it is possible.
Start a few emulators.
Create run configuration that shows chooser dialog (target device).
Run configuration.
Select all running emulators when Android Studio asks.
This will work only for non debug Android Application configuration, it will not work for Android Tests or debug configurations.
You can also run Gradle command connectedCheck to run tests on all devices outside of Android Studio.

Related

How to view the stack trace of errors that occur while running an app with an Android emulator (without Android Studio)

I am currently learning how to develop apps on Android in Java, and I'm right now I'm attempting to build and install programs from the command line (without Android Studio). Right now, I'm using gradle to build and install a program to an emulator. The problem now is that my app is crashing immediately and I have no idea why. The gradle command gradle installDebug just installs the app and terminates. The emulator command emulator -avd Nexus_5X_API_28 -verbose similarly gives me a bunch of useful information at startup but is completely silent while my app crashes. I'm wondering how exactly I'm supposed to see the stack trace resulting from the crash.
There's a program bundled into the Android SDK (or maybe it's installed automatically by Android Studio, I'm not sure) called the Android Device Monitor. By default, it can be accessed by running ./pathToSdk/tools/monitor. And from there you have the same windowed thing that used to be used in older versions of Android Studio. It's not a pure command-line solution, and it may require installing Android Studio beforehand, but it works very well.

Android emulator does not run but Gradle builds successfully

I am new to Android Studio and I am facing this weird kind of behavior.
I have built a raw project in Android Studio and I have configured Andriod AVD.
Gradle builds successfully though. It shows waiting for the device to come online.
I am using a Mac.
You can run on real device to check what happen of you can down load genymotion and run your application on that virutal machine

Using gradle to test android apps in an emulator

Ok I want to use gradle to run my tests in an emulator.
gradle has two targets that allow me to run tests:
connectedCheck
deviceCheck
If I understood correctly, we should use deviceCheck to test stuff in an emulator, but when I run it runs no tests.
connectedCheck also doesn't work because it can't find a device (emulators don't appear in the Android Studio the way my cell phone do).
What I would like is (ideally):
run my gradle script
it boots up an emulator
it runs tests on that emulator
it turns down the emulator
I would also like to have a target that won't boot or turn down the emulator, but it will use one if one is up.
It's possible to do any of these things? I can't find documentation anywhere on how to configure gradle android plugin.
An emulated device is a connected device. I can't tell that gradle has a way of starting an emulator for you short of an Exec task. I leave a couple emulators always running in the background with -no-window, and on our CI I did up a little bash script to fire up a few at various API levels before gradle is invoked and then shut them down afterward.
I came here searching for an example of how deviceCheck is used. It seems like it's supposed to be self-evident.

Run my android program on real smartphone Android 4

I'm writing Android application on Ubuntu ADT and run it on device with Android version 2.3. How can I run on android version 4.X?
How can I run on android version 4.X?
The same way you run it on any Android device -- by enabling USB debugging in Developer Options and plugging in the device. You might need to tweak some udev values on your Ubuntu box, but that's not likely.

How to install app from Android Studio on emulator (maybe using Gradle)?

I'm normally testing my android app on a physical device, but today I want to do some testing using an emulator. So I created one and it's running fine. I now want to install my app on my emulator. I normally install the app on my device using the Gradle task "installDebug". In the list of Gradle tasks I can't find anything which refers to the emulator though. Although this should be an easy thing to do, I can't find any place in Android Studio to do this.
So I found this question here on SO which explains a way to do it from the command line. Although I'm not afraid of the terminal it would be great if I can just do it from within Android studio/IntelliJ so it goes quick and easy.
Any tips on how to install my app on the emulator from within Android Studio (either using a Gradle task or not) would be great!
Emulator instances act just like physical devices for the purposes of the installDebug task in Gradle, in ADB, and the Android Debug Monitor. If you only have an emulator running and no physical device connected, most things will simply use the emulator by default without needing to ask you; if you have an emulator as well as devices, then you may need to choose which one to use in the same way you would if you had multiple physical devices.

Categories

Resources