Flutter integration test not working, uri not found

Issue

Edit: tl;dr If you’re getting "Target of URI doesn’t exist" errors when adding a new package, try closing the Android Studio project and re-opening it.

I’m just getting started with integration testing on my Flutter app and for some reason it can’t find the integration_testing uri.

error

I’ve followed all the steps here including:

  1. Updating my pubspec.yaml
dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter
  1. Creating the integration_test/app_test.dart directory and file:
    enter image description here

  2. Run pub get, flutter clean.

  3. On latest flutter version and no issues with doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.3, on macOS 11.3.1 20E241 darwin-arm, locale
    en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version
    32.0.0-rc1)
[✓] 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 2021.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Here’s the complete pubspec.yaml

name: squabbit
description: A new Flutter application.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.8.0+80

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^1.1.0
  firebase_auth: ^1.1.3
  firebase_storage: ^8.0.5
  cloud_firestore: ^1.0.7
  firebase_crashlytics: ^2.0.2
  rxdart: 0.26.0
  intl: ^0.17.0
  #  file_picker: ^1.1.1
  google_sign_in: ^5.2.3
  image_picker: 0.7.4
  cached_network_image: ^3.0.0
  flutter_google_places: ^0.3.0
  google_maps_webservice: ^0.0.19
  carousel_pro: ^1.0.0
  flutter_launcher_icons: ^0.9.0
  package_info: ^2.0.0
  mime: ^0.9.7
  google_fonts: 2.1.0
  enum_to_string: 1.0.14
  shared_preferences: ^2.0.5
  algolia: 1.0.1
  flutter_email_sender: ^5.0.0
  device_info_plus: ^1.0.1
  material_design_icons_flutter: 4.0.5955
  visibility_detector: ^0.2.2
  fluttertoast: ^8.0.7
  in_app_review: ^2.0.2
  cloud_functions: ^3.0.0
  firebase_analytics: ^8.2.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  in_app_purchase: ^0.5.2
  firebase_messaging: ^11.2.6
  firebase_remote_config: ^2.0.2

dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter

flutter_icons:
  android: false
  ios: true
  image_path: "assets/icon/icon.png"


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  assets:
    - assets/images/

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

Solution

I tried adding another package and got the same problem. Turns out closing the project in Android Studio and re-opening it fixed the problem.

Answered By – odiggity

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *