Flutter integration tests won't run - flutter

I am trying to write some integration tests using the flutter driver based off of the example here: https://flutter.io/testing/. I am able to get the app to deploy, but all I get back is awaiting for app response.
I'm really not sure what else to do as it just sits and waits.
Here's what I see in the terminal.
flutter drive --target=test_driver/home_category_list_scroll.dart
Using device Sampson's iPhone.
Starting application: test_driver/home_category_list_scroll.dart
Automatically signing iOS for device deployment using specified
development team in Xcode project: QDCF25JLN2
Running pod install... 7.2s
Starting Xcode build...
├─Assembling Flutter resources... 13.0s
└─Compiling, linking and signing... 7.5s
Xcode build done. 27.6s
Installing and launching...
flutter: Observatory listening on http://127.0.0.1:54774/
00:00 +0: scrolling performance test (setUpAll)
[info ] FlutterDriver: Connecting to Flutter application at
http://127.0.0.1:54270
[info ] FlutterDriver: Waiting for application to start
[info ] FlutterDriver: Waiting for application to start
[info ] FlutterDriver: Waiting for application to start
Here's are the first few lines of the test.
void main() {
group('scrolling performance test', () {
FlutterDriver driver;
setUpAll(() async {
// Connects to the app
driver = await FlutterDriver.connect(dartVmServiceUrl: 'http://127.0.0.1:54270');
});
tearDownAll(() async {
if (driver != null) {
// Closes the connection
driver.close();
}
});
test('measure', () async {
Flutter Doctor output:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.8-pre.56, on Mac OS X 10.13.4 17E202, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Community Edition (version 2017.1.6)
[!] VS Code (version 1.24.1)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.
Thank you for any ideas you can give me.

Could you check if an Xcode build config is set that may be overriding the target file flutter drive was running? I found a similar issue and setting flavors worked on the integration test for them.

use flutter run and look at the url that returns in the console where the app is running, that is the one you should use in your dartVmServiceUrl parameter
source: https://medium.com/flutter-community/blazingly-fast-flutter-driver-tests-5e375c833aa

Related

location_geocoder Bad state: No element

if i want to make use from geocoder it given me this error message: Bad state: No element.
what i now is that i have giving geocoder a correctly written city name and also that i have given geocoder a api key from a payed google maps platform account.
flutter run:
Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install... 14.3s
Running Xcode build...
└─Compiling, linking and signing... 13.8s
Xcode build done. 633.2s
Syncing files to device iPhone 13... 186ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
💪 Running with sound null safety 💪
An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:50040/6fcE371o6S0=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:50040/6fcE371o6S0=/
flutter: null
flutter: stadt_view: bansko
flutter: Bad state: No element
flutter: null
i now that ther don't stand anything from location_geocoder but if i comment the geocoder part out: i don't have the bug anymore.
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 12.1 21C52 darwin-x64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
[✓] VS Code (version 1.64.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
Please help me
just use http package instead location_geocoder that worked for me

Flutter run Error: No such file or directory

When I try to run my app. It shows me this error
Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 14,5s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 26ms
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to open C:\Users\...\build\app\outputs\flutter-apk\app.apk:
No such file or directory
Error launching application on AOSP on IA Emulator.
I try it also with a physical device but I get still the same error.
I have tried many things.
Wipe Data
Cool boot
Create new Emulator
But non of them worked for me.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1052], locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Chrome - develop for the web
[√] Android Studio
[√] VS Code (version 1.58.0)
[√] Connected device (3 available)
• No issues found!
I am happy for any help!
Did you try to enable software rendering?
flutter run --enable-software-rendering
Honestly if I were you, I'd just re-make a new app with flutter create ...
and then transfer all of the files from your old proj. - I know it's a pain to redo the pubspec.yalm but it's what I would do
found a fix, simply move the file(app.so) from
\build\windows\runner\Debug\app.so;
to build\windows\runner\Debug\data\app.so
in most case you have to locate the app.so, i cannot define the structure of your project, but once you find the app.so file simply move it into the \build\windows\runner\debug\data folder

Flutter run lost connection to device in iOS

I did an app in android, now trying to run it in ios. I am getting the bellow error
Xcode build done. 35.2s
Configuring the default Firebase app...
Configured the default Firebase app __FIRAPP_DEFAULT.
6.34.0 - [Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not exist.
6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started
6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ....)
Waiting for iPhone 11 to report its views... 4ms
6.34.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
Lost connection to device.
Syncing files to device iPhone 11...
(This is taking an unexpectedly long time.)
I have other ios apps which are running perfect.
Running flutter doctor shows this
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B50 darwin-x64, locale
en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[!] Android Studio (version 3.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
Edit = Removed firebase
I removed the firebase thing and getting a plain message like this
Running pod install... 3.0s
Running Xcode build...
└─Compiling, linking and signing... 9.1s
Xcode build done. 35.8s
Waiting for iPhone 11 to report its views... 3ms
Lost connection to device.
Syncing files to device iPhone 11...
(This is taking an unexpectedly long time.) ⣻
Any idea what could be wrong?
Thank you.
You are using Firebase and you probably forgot to add firebase's GoogleService-Info.plist file to your IOS project from xcode.
Also sometimes you need to run pod install inside IOS project to install the required pods.
I know I'm already late here, but this could be caused by improper configuration from Google Map or other API keys from within iOS. Try running the app in Xcode and you will get a more helpful error message.
In my case, it was a Google Map API key missing.
Solution:
Open AppDelegate.swift
Add import GoogleMaps along with the other imports
Add the following statement above GeneratedPluginRegistrant.register(with: self): GMSServices.provideAPIKey("YOUR_API_KEY_HERE") where YOUR_API_KEY would be something like AIzaSyBHV....wZEIg from the Cloud Console.
You may be creating a Secondary App as described in FlutterFire docs. https://firebase.flutter.dev/docs/core/usage/
The Secondary APP just worked in an Android Environment for me. I found a workaround loading the options from the previously created.
In that way, it worked in IOS.
Something like this:
// Uses the default GoogleService-Info.plist
final Future<FirebaseApp> _firebaseDefaultApp = Firebase.initializeApp();
List<FirebaseApp> apps = Firebase.apps;
_firebaseSecondaryApp = Firebase.initializeApp(name: "SecondaryApp", options: apps[0].options);

Error connecting to the service protocol: Exception: Attempted to connect to Dart observatory 5 times, and all attempts failed. Giving up. The URL was

My app starts but then stops because of the error. I am using Windows 10, android studio as an IDE, and trying to build an android app.
if I use a terminal outside of Android studio it works, so it should be android studio related.
console:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Error connecting to the service protocol: Exception: Attempted to connect to
Dart observatory 5 times, and all attempts failed. Giving up. The URL was
ws://127.0.0.1:50997/ws
flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version
10.0.16299.847], locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android license status unknown.
[√] Android Studio (version 3.2)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
If you have configured a proxy,
ensure you have also set the environment variable
NO_PROXY=127.0.0.1

Flutter Hello world app can't start on Android Emulator x86_64

I am currently working on Xamarin Forms and want to try Flutter.
I created a Flutter project with Android Studio. But I can't run it.
I get this error on Android Emulator
Error launching the application on Android SDK built for x86 64.
flutter doctor looks fine.
some example app like Flutter Gallery can work but some can't.
The platform is Windows 10 64 bit.
Android Studio 3.2.1
Error Message is:
Launching lib\main.dart on Android SDK built for x86 64 in debug
mode... Initializing gradle... Resolving dependencies...
Gradle task 'assembleDebug'... Built
build\app\outputs\apk\debug\app-debug.apk. Installing
build\app\outputs\apk\app.apk... Error: ADB exited with exit code
1 adb: failed to install
C:\Users\xxx\source\flutter\flutter_app\build\app\outputs\apk\app.apk:
Error launching application on Android SDK built for x86 64.
C:\flutter>flutter doctor Doctor summary (to see all details, run
flutter doctor -v): [√] Flutter (Channel stable, v1.0.0, on
Microsoft Windows [Version 10.0.17134.472], locale zh-TW) [√]
Android toolchain - develop for Android devices (Android SDK
28.0.3) [√] Android Studio (version 3.2) [√] IntelliJ IDEA Community Edition (version 2018.3) [!] VS Code, 64-bit edition
(version 1.30.1) [!] Connected device
! No devices available
! Doctor found issues in 2 categories.
As you can see from those lines:
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
You are missing the plugin for flutter and dart.
Go to:
File -> Settings -> Plugins
and install Flutter
And check to see if dart was installed as well