ansible-role-varnish icon indicating copy to clipboard operation
ansible-role-varnish copied to clipboard

Error when using mokito 5.3.0 and connectycube sdk 2.2.1

Open wamynobe opened this issue 2 years ago • 8 comments

Specify the sample to which the issue belongs (use [x]): [] Chat sample [x] P2P Call sample [] Conference Call sample

Platform (use [x]) [x] Android [] iOS [] macOS [x] Windows [] Web

Device info Manufacture: google Model: pixel 4 OS version: android sdk 32

Describe the bug: I am currently using mokito 5.3.0 and connectycube_sdk 2.2.1 when i run flutter packages pub run build_runner build --delete-conflicting-outputs it thows error

Steps to Reproduce:

  1. add mokito 5.3.0
  2. add conectycube 2.2.1
  3. run flutter pub get
  4. run flutter packages pub run build_runner build --delete-conflicting-outputs

Logs:

[WARNING] /C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:412:19: Error: The getter 'libraryExports' isn't defined for the class 'LibraryElement'.
 - 'LibraryElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'libraryExports'.
      ...entryLib.libraryExports,
                  ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:413:19: Error: The getter 'libraryImports' isn't defined for the class 'LibraryElement'.
 - 'LibraryElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'libraryImports'.
      ...entryLib.libraryImports,
                  ^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1493:36: Error: The getter 'enclosingElement2' isn't defined for the class 'ParameterElement'.
 - 'ParameterElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
          final method = parameter.enclosingElement2!;
                                   ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1524:30: Error: The getter 'enclosingElement2' isn't defined for the class 'ParameterElement'.
 - 'ParameterElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
    final method = parameter.enclosingElement2 as MethodElement;
                             ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1525:27: Error: The getter 'enclosingElement2' isn't defined for the class 'MethodElement'.
 - 'MethodElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
    final class_ = method.enclosingElement2 as ClassElement;
                          ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1535:28: Error: The getter 'enclosingElement2' isn't defined for the class 'ExecutableElement'.
 - 'ExecutableElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
          overriddenMethod.enclosingElement2 as ClassElement, name);
                           ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1934:23: Error: The getter 'enclosingElement2' isn't defined for the class 'Element'.
 - 'Element' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
      var className = enclosingElement2!.name;
                      ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-5.3.0/lib/src/builder.dart:1937:23: Error: The getter 'enclosingElement2' isn't defined for the class 'Element'.
 - 'Element' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'enclosingElement2'.
      var className = enclosingElement2!.name;
                      ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/freezed-2.0.4/lib/src/tools/type.dart:27:16: Error: The getter 'imports' isn't defined for the class 'PrefixElement'.
 - 'PrefixElement' is from 'package:analyzer/dart/element/element.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-3.4.1/lib/dart/element/element.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'imports'.
      return e.imports.any((l) {
               ^^^^^^^

or Gist log

Actual result: Failed to precompile build script

Expected behavior: success

Additional info none

wamynobe avatar Aug 02 '22 13:08 wamynobe

@wamynobe I just added the dependencies from steps 1-2 to our P2P Calls Sample

Screenshot 2022-08-02 at 17 02 13

and ran your commands from steps 3-4 and it works well:

MacBook-Pro:p2p_call_sample tereha$ flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 622ms

[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 7.9s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 670ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[INFO] 2.4s elapsed, 0/14 actions completed.
[INFO] 3.5s elapsed, 0/14 actions completed.
[INFO] 4.8s elapsed, 0/14 actions completed.
[INFO] Generating SDK summary completed, took 5.6s

[INFO] 6.6s elapsed, 2/14 actions completed.
[INFO] 7.7s elapsed, 2/14 actions completed.
[INFO] 8.7s elapsed, 2/14 actions completed.
[INFO] 9.8s elapsed, 2/14 actions completed.
[INFO] 10.8s elapsed, 2/14 actions completed.
[INFO] 18.5s elapsed, 2/14 actions completed.
[INFO] 19.7s elapsed, 4/14 actions completed.
[INFO] 22.0s elapsed, 5/14 actions completed.
[INFO] Running build completed, took 22.4s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 68ms

[INFO] Succeeded after 22.5s with 0 outputs (14 actions)

Are you sure that your issue is related to our lib?

TatankaConCube avatar Aug 02 '22 14:08 TatankaConCube

Hi @TatankaConCube I'm not sure but I spent hours on this problem and I find out that it happens when I add some dependencies in dev_dependencies. Here is my pubspec.yaml please help me to check it out. *note: when I deleted freezed: ^2.0.3+1 and mockito: ^5.3.0 in dev_dependencies it works perfectly. thank you for your response, have a good day!

name: test
description: TestAPP
version: 1.0.0-dev+7
publish_to: none

environment:
  sdk: ">=2.17.0 <3.0.0"

dependencies:
  auto_route: ^4.2.1
  auto_size_text: ^3.0.0
  cached_network_image: ^3.2.1
  card_swiper: ^2.0.4
  connectycube_flutter_call_kit: ^2.0.5
  connectycube_sdk: ^2.2.1
  dartz: ^0.10.1
  dotted_border: ^2.0.0+2
  firebase_core: ^1.20.0
  flash: ^2.0.3+3
  flutter:
    sdk: flutter
  flutter_background: ^1.1.0
  flutter_bloc: ^8.0.1
  flutter_form_builder: ^7.3.1
  flutter_form_field_validator: ^1.0.0
  flutter_html: ^3.0.0-alpha.5
  flutter_localizations:
    sdk: flutter
  flutter_rating_bar: ^4.0.1
  flutter_svg: ^1.0.3
  form_builder_validators: ^8.3.0
  freezed_annotation: ^2.0.3
  hive: ^2.2.3
  image_picker: ^0.8.5+3
  intl: ^0.17.0
  introduction_screen: ^3.0.1
  json_annotation: ^4.6.0
  loader_overlay: ^2.0.9
  modal_bottom_sheet: ^2.1.0
  pin_code_fields: ^7.4.0
  shared_preferences: ^2.0.15
  shimmer: ^2.0.0
  simple_ripple_animation: ^0.0.3
  universal_io: ^2.0.4
  

dev_dependencies:
  auto_route_generator: ^4.0.0
  bloc_test: ^9.0.3
  build_runner: ^2.1.11
  dart_code_metrics: ^4.16.0
  dependency_validator: ^3.2.2
  flutter_gen_runner: ^4.3.0
  flutter_test:
    sdk: flutter
  freezed: ^2.0.3+1
  import_sorter: ^4.6.0
  json_serializable: ^6.3.1
  mockito: ^5.3.0
  mocktail: ^0.3.0
  very_good_analysis: ^3.0.1

flutter_gen:
  output: lib/gen/
  integrations:
    flutter_svg: true
import_sorter:
  comments: false

flutter:
  uses-material-design: true
  generate: true
  assets:
    - assets/screens/

wamynobe avatar Aug 02 '22 16:08 wamynobe

then try to delete our libs from your project and try to build your app, if it builds, we will try to investigate on our side. but we need the full build log for it

TatankaConCube avatar Aug 02 '22 16:08 TatankaConCube

Thank for your answer @TatankaConCube . I've been try to remove your libs and build my app then it works perfectly. Can I know what exactly build log you prefer.

wamynobe avatar Aug 02 '22 17:08 wamynobe

I mean the console output when you build your app with included our libs

TatankaConCube avatar Aug 02 '22 17:08 TatankaConCube

Thank for your answer @TatankaConCube . I deleted connectycube_sdk: ^2.2.1 then run step 4 after that I add connectycube_sdk: ^2.2.1 and run step 3 => the app works well. I think the problem is some conflict between some dependencies. So the connectycude dependency prevents me from generating new freezed class. *note : the app works well with your libs but it's prevent me from generating freezed class with freezed: ^2.0.3+1

wamynobe avatar Aug 03 '22 01:08 wamynobe

how do you see how can we help you to resolve this case? does our SDK requires any changes?

TatankaConCube avatar Aug 03 '22 07:08 TatankaConCube

I'm not sure. Sorry because I cannot find where exactly the problems were. It just cannot run normally when I use it with dependencies which were noted in the comment above. Please help me check it out! Thanks a lot! Have a good day @TatankaConCube

wamynobe avatar Aug 05 '22 15:08 wamynobe

no activity for a long time, so closing

TatankaConCube avatar May 17 '23 10:05 TatankaConCube