Flutter Integration Test run/debug configuration in Android Studio - android-studio

I am trying to run/debug some integration tests on a flutter project. my tests are running fine when I run "flutter drive --target=test_driver/app.dart" on my project.
I am trying to create a Debug configuration in my Android Studio as per following steps in the StackOverflow answer-
How to automate Flutter Integration testing command?
however, when I try to run the test with this configuration I get the following error
Any pointers about how this can be resolved?
Removing Break points and Flutter clean did not yield any results
00:00 +0: Flutter Driver demo (setUpAll)
[info ] FlutterDriver: Connecting to Flutter application at http://127.0.0.1:55319/L_Bm--V4Kjg=/
[trace] FlutterDriver: Isolate found with number: 283666305
[trace] FlutterDriver: Isolate is not paused. Assuming application is ready.
00:00 +0 -1: Flutter Driver demo (setUpAll) [E]
JSON-RPC error -32601 (method not found): Method not found
package:json_rpc_2/src/client.dart 110:64 Client.sendRequest
package:json_rpc_2/src/peer.dart 68:15 Peer.sendRequest
package:vm_service_client/src/scope.dart 64:23 Scope.sendRequestRaw
Run Configuration is as follows

Checking the logs and your setup, the run config is fine and works without issues. The issue here is caused by a "Method not found" error thrown by json_rpc_2. Trace where the error is thrown from your test, and see if this could just be an unhandled Exception that causes the issue.
Another workaround here is to set up flutter drive as an External Tool, and configure created External Tool to run 'Before launch'. Note that the path set on 'Program' points to the Flutter SDK.
This works well for me, and using this approach, you won't need to set a VM_SERVICE_URL Environment for your flutter drive run config.

Related

VS AppCenter - XCUI - Getting Failed to analyze MachO file error

I am creating an azure Devops pipeline for UI testing my iOS application.
I have built my project and feeding my ipa to Visual Studio AppCenter Test pipeline, I was getting the error,
Error: Failed to analyze MachO file: Unknown load command: 2147483700
I tried to run my code manually using appcenter-cli from terminal and still getting the same error. I saw this issue in GitHub and not sure how to do this workaround in devops pipeline.
Am I missing something here? Can no-one use AppCenter CLI because of this issue?
You have to build your app with xcode 11 and than it works. But this is just a workaround. Hopefully they will fix it in the near future.

Debug run with AndroidTestOrchestrator stuck waiting for debugger

When running an Espresso test with Android Test Orchestrator enabled the test runs fine without Debugger but when starting test with Debugger the test just hangs with the following logcat message:
I/AndroidTestOrchestrator: Waiting for debugger to connect...
The test also runs fine with Debugger attached if I disable Android Test Orchestrator.
Any ideas how to get this working or if this is a known issue?
Environment
Android Studio 3.1.3
Support Test Library version: 1.0.2
Target SDK: 27
Device under Test: Emulator API 27
Looks like this is a bug in Support Test Library 1.0.2 per https://issuetracker.google.com/u/1/issues/78658117.
I was able to workaround the issue by downgrading to 1.0.1 but also reset my emulator data before being able to Debug with Orchestrator.

Gradle build error using react native

I get this error when trying to run an app on an android emulator(Android Studio) from a console window:
$ react-native run-android
Scanning folders for symlinks in C:\Users\Brian\desktop\codervets\arrive-alive\aa_app\node_modules (27726ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 4m 51s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
And yet my sdk directory in android studio has the following directory:
C:\Users\Brian\AppData\Local\Android\Sdk
Has anyone else ran into this issue? If so, how do I fix it?
The error states:
The SDK directory 'c:\Users\eelia001\AppData\local\android\sdk1' does not exist.
And you say your SDK is in:
C:\Users\Brian\AppData\Local\Android\Sdk
Since those aren't the same directory, my guess is that's the problem. Are you perhaps logged in as the wrong user? You're going to want to check that ANDROID_HOME is set correctly.
So I'm not sure why it was setup the way it was, but the way to fix it is to go to Advanced System Settings → Environment variables. Thank you to #Rich Churcher for the link to a proper tutorial (it's outdated but the steps worked).

Visual Studio Doesn't Create Xamarin Bin Folder

I'm trying to build an iPad project from Visual Studio 2017 for windows, However whenever I try to debug the app I get this error
Launch failed. The app 'B2C.iPad' could not be launched on 'iPad Air
iOS 11.0'. Error: error MT0069: The app directory
'/Users/user/Library/Caches/Xamarin/mtbs/builds/B2C.iPad/acb039527d504c900b2e6c86d8d84d09/bin/iPhoneSimulator/Debug/MobiBusiness.app'
does not exist. . Please check the logs for more details.
I noticed that visual studio doesn't create bin folder on the Mac machine although it indicates the build is succeeded.
I tried building the solution without debugging and looked at the log file nothing looked suspicious and there was no error.
does anyone know what might cause this error?
Okay this is embarrassing apparently the iPad project wasn't not selected in the build configuration, so needed to select the projects from build --> Configuration Manager

Android studio 1.5.1 cannot build

Lately, I encounter a lot of problems using Android Studio.
I'm using Android Studio 1.5.1, with gradle plugin 1.5.0 (corresponding to Gradle 2.2.1, I think), on Windows 7.
There is no update for Android Studio for now, and neither in standalone SDK manager.
Sometimes when I try to launch my app on an emulator, the builing process wont stop (I waited for 1 hour once...). Even after I quit the emulator and just build project on sync gradle, it launch a process that never ends. The log file is not writing and there is no error message anywhere.
For the process to end, I have to go to the taskmanager and stop every java.exe process I see, and it then shows this message :
Error:Unable to start the daemon process. This problem might be caused
by incorrect configuration of the daemon. For example, an unrecognized
jvm option is used. Please refer to the user guide chapter on the
daemon at https://docs.gradle.org/2.8/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
After that, not any build will succeed, and the only way for my project to successfuly build is to reboot my OS ! (even after taskkilling every known related task, like android64.exe, adb.exe, java.exe)
Is the bug known ? Is there any workaround ? Am I doing something wrong ?
Further details
When it bugs, the gradle console is writing
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]`.
, but then nothing. It's more that gradle is not working than it's stroking on one point. But there still is that java.exe process with its 66Mb of memory...
It bugs after approximately 8 successful runs.
Last updates
I know now the real troublemaker ! It is C:\Users\Me\.gradle\daemon\2.8\registry.bin
I can't even right click on it without crashing Windows Explorer !
I have been facing the same problem. However, I had a previous project which had been successfully built. What I did was - changed the location of Service Directory Path(the one pointing to the '.gradle' folder) of my new app to the Service Directory Path of the successfully built app, i.e from
C:/Users/YOUR USERNAME/AndroidStudioProjects/CURRENT APP/.gradle
to
C:/Users/YOUR USERNAME/AndroidStudioProjects/SUCCESSFULLY BUILT APP/.gradle
To change the service directory path-
go to settings --> Build, Execution, Deployment --> Build Tools --> Gradle --> service directory path

Resources