I am using multiple build variants in my Gradle using flavorDimensions.
When debugging, how do I choose which variant is run when using Android Studio run?
Android Studio has a View simply called as "Build Variants". It is generally along with "1:Project" and "7:Structure" views. Pressing that lets us choose which build variant needs to be executed when running the app.
Related
I'm trying to build a KMM project using Android Studio. I can see two separate configurations as well, each for AndroidApp and iOSApp. But the iOSApp configuration doesn't have an Execution target. Neither does it show any simulators in the dropdown.
I do have Xcode installed and have run other iOS apps successfully in the iPhone Simulator.
p.s. I'm on M1 mac
once you run the project you'll see a iosApp.xcodeproj file being generated .. make sure your android studio pane is in project mode.
Once a successful build is done you'll be able to open this .xcodeproj file from within xcode
I have not been able to do that as well. If there is a build failure the reason is it is not finding the common folder. To do that open the terminal and run gradlew tasks.There
should be a task allowing you to ready the shared folder with xcode
First select the device in which device you want to use in simulator then find build option and then click on it, your simulator automatically will popup on the screen
I'm using Visual Studio for Mac, creating Android apps using Xamarin. Whatever I do, VS seems to start a "default" emulator. But I wan't it to use my newly created emulator.
How can I choose emulator, or set a default one?
Previously in XS, there used to be a dropdown selector, it seems to have been removed:
More information. I created a fresh project from scratch, when the menu actually appears:
I figured it out.
I had not enabled the android project for BUILD in the build configuration.
To enable it just right click your solution, click options, under Build > Configurations > Configuration Mappings you may enable your android project as shown below.
When I make some changes in source code, Android Studio (actually gradle) needs to rebuild the project. It's obvious.
Why the second build takes almost the same amount of time like the first build, even if I haven't made any changes in the project?
When I look into GradleConsole it waits on "assembleDubug" task. I think gradle should be aware there're no changes and shouldn't waste so much time on it.
Finally, I found the solution: turn on Offline work for gradle.
or using CLI:
./gradlew --offline assembleDebugOrWhatever
Does the gradle console say
:app:assemeble UP-TO-DATE ?
If you take a look at the run configuration, you might notice at the very bottom Before Launch: Gradle-aware Make
This is just telling it to recompile(if necessary) before running, but that detection is delegated to Gradle. Gradle will only actually recompile if it detects that it needs to, but the assemble task must still attempt to run to detect UP-TO-DATEness. So it says it's running it, but its not actually doing anything. When I run it two times in a row, the first time it takes a while to do everything, BUT the second time it just runs through the task list pretty quickly (with a bunch of UP-TO-DATEs) and deploys to phone/emulator.
To avoid rebuild EACH TIME, i'm going to my module project settings -> Dependencies and up or down one of my library item -> Apply -> Ok -> Make regenerating R.java.
You could also try unchecking "Use external build" in compiler settings:
File -> Settings (Ctrl+Alt+S) -> Compiler -> Uncheck "Use external build"
This isn't a problem per se. And it has nothing to do with Android Studio since Gradle is just an Android Plugin that helps you build your projects. You need to fully understand what gradle does to know why Android Studio uses it whenever you run your apps. Take a look at this nice SO question on gradle and the android developer website's article on it. Finally, from my personal experience,when it comes to dealing with Android Studio and Eclipse for Android development, you need to be a little patient. Hope this helps in some way.
Is there an easy way to build, install, and auto-launch a custom Gradle build in Android Studio?
When I press the "Play" (Run) button in Android Studio (with a typical Android project configuration), my project builds, installs it on the proper device, and then launches the app.
How can I do this with specific Build/Product flavors (using Gradle)? I've gotten as far as creating a Gradle configuration that runs the task "installFlavor1." This installs correctly, but it doesn't auto-launch the app.
You can always select a different buildVariant from the buildVariant window on Android Studio. And then if you press the run/play button you should be able to install and run the app on your device/emulator.
And also for me running gradlew install** on the terminal does not launch the app.
If that's something you are looking for then take a look at build.gradle and buildhelper.gradle here
I am using Helios Service Release 1, with the Android SDK 2.3.1 API 9 r2. Everytime I create a new Android project, and got to run it always gives me an error as it is trying to run it as a Javabean! In order to run it I have to either add the project as an Android app in the Run config. or right click on the Project and select run as Android App.. Anyone have this problem or can suggest something I can try to change the default?
Thanks
I do not use Android SDK, but I solved this problem in my Eclipse instance by uninstalling Visual Editor component.
(e.g. like this, depending on Eclipse version: Menu->Help/Install New Software/What is already installed/Installed Software)
Perhaps your run configuration is messed up and you need to configure it properly.
Go to Preferences -> Run/Debug -> Launching
and check what you have under Launch Operation.