I have been following this Flutter doc:
https://flutter.dev/docs/cookbook/testing/unit/introduction
And I can run the test in Android Studio if I open the file and run it by tapping the run button.
Thing is I want to run all tests with the push of one button, like in Xcode.
How to do that in Android Studio?
What I did:
Created two dumb tests, just for the sake of having them.
Created test configuration with All in Directory option and pointed to test directory:
And after hitting Play button I get:
Failed to load "/Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart":
Test never connected to test harness.
Test: /Users/martinberger/Dev/flutter_apps/iCash/icash/test/second_test.dart
Shell: /Users/martinberger/Dev/flutter/bin/cache/artifacts/engine/darwin-x64/flutter_tester
So the first test complete, but next one, do not even start.
Of the dozen or so tutorials/blogs/docs I have read about this, they all focus on writing one test and running it by right-clicking or by having it open and clicking Play button.
I am coming from iOS/Xcode background so is there something I should know about running a simple test suite in Android Studio?
You can type flutter test and then the directory you want in the terminal.
So in your case: flutter test test/
Related
Maybe I'm just missing something but is there a way to trigger the iOS build in Android Studio for a KMM project that doesn't launch the simulator once the build is done?
When looking at the iosApp run configuration I see it has "Build iOS application" listed under "Before Launch" which makes me suspect this is possible but I didn't see it listed as a gradle task or anywhere else I could think of.
I've been doing the iOS work in Xcode and when I make changes to the shared code I want to rebuild it without running the app (which I've been doing from inside Xcode).
Not exactly a solution, but I found that when you hit build in Xcode it builds the Kotlin code so any changes to the shared module are included automatically. No need to do iOS builds from Android Studio.
I repeatedly run into the problem, that Android Studio is not deploying the app on the mobile device.
When I hit the play button it shows the following message in the 'Run'-Tab:
02/16 12:08:06: Launching 'App' on Physical Device.
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: debug
Normally, I can fix this by hitting the "Sync project with gradle files"-Button or just trying to deploy again. So this is not the main problem.
The annoying part is, that Android Studio shows the green "Success. Operation succeeded"-Bubble next to the run tab, even if nothing was deployed to the device.
Is this a problem in the IDE? Can it somehow be configured to show an error instead?
I am using Android Studio 4.1.2
run -> edit configuration -> before launch
click on add button and select gradle-aware make
then press apply and then OK
by above step my app run successful
I have created a default project with libGDX and imported it in android studio
i have not even touched the code and it is the default template that libGDX creates.
When i run it on android virtual device it works fine and displays a red screen and badlogic logo.
Problem occurs when i try to run the same thing as a desktop app.
when i click run, the app runs and displays the red background with badlogic logo however, Gradle Build Running is displayed in android studio status bar and it never completes, meanwhile the app is running image of what im talking about
Then when i stop the app i get the following error
Execution failed for task ':desktop:DesktopLauncher.main()'.
Build cancelled while executing task ':desktop:DesktopLauncher.main()'
How do i get gradle to finish the build for desktop app? if i run it on android emulator the build completes successfully in less than 10 seconds
More details:
in the edit configurations i have set the
main class to: com.packagename.desktop.DesktopLauncher
working directory: pointing to android assets
Other than that i haven't touched anything else. I've been searching the internet for the answer for hours and haven't found my issue. Thanks in advance for any clues to what is causing this. All the best :)
My Flutter project was working just fine. I lost my Internet connection for a bit and when it came back I got a pop up talking about an Android Configuration found for the project, I clicked Add, then it started showing me two Device slots on the Upper tab where it shows what devices are connected.
Now if I need to run my app on my device, Flutter simply tries to run the project, then stops without any output in the Run Tab of Android Studio. This is really giving me a headache... I wish it gave an error or something. Someone please help me so i can resume development.
if you have not changed anything in the android directory the easiest thing to do is to delete it, then run in the terminal
flutter create .
if you have changed a lot of things in the android you can copy your changes and do the same or can go an revert the gradle configurations manually.
When you press the run button in Android Studio the project is buit again, and as you know this always take long, if e.g. I select Build -> Make Project and then "Run" the make process runs again, I don't understand why? I would expect that it only installs the APK that is already generated. Is there a way I can achieve this, is my expectation funded or am I thinking wrong?
I've used the approach described here to speedup my build.
Building and running app via Gradle and Android Studio is slower than via Eclipse
At the same time i've disabled "make project automatically" because sometime it produces old code.