Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve the package 'dreaming_application' in 'package:dreaming_application/page/MainPresenter.dart'. #89090

Closed
isong0623 opened this issue Aug 28, 2021 · 6 comments
Labels
r: invalid Issue is closed as not valid

Comments

@isong0623
Copy link

isong0623 commented Aug 28, 2021

open android project and run it's ok ,but open flutter project got error.
when remove package name replace with relate file path, no error log, but got new seem error.

I'm sure the code no problem, I did't know how the dart code analysis in flutter project.

Here's the error log:

Running "flutter pub get" in dreaming_application...                0.8s
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Invalid depfile: E:\My_WorkSpace\dreaming_application\module_common\.dart_tool\flutter_build\2959f35bec37b79bed3400c406fcb80b\kernel_snapshot.d
Invalid depfile: E:\My_WorkSpace\dreaming_application\module_common\.dart_tool\flutter_build\2959f35bec37b79bed3400c406fcb80b\kernel_snapshot.d

Compiler message:
Error: Could not resolve the package 'dreaming_application' in 'package:dreaming_application/page/MainPresenter.dart'.
../lib/page/MainPage.dart:18:8: Error: Not found: 'package:dreaming_application/page/MainPresenter.dart'
import 'package:dreaming_application/page/MainPresenter.dart';
       ^
../lib/page/MainPage.dart:38:32: Error: Type 'MainPresenter' not found.
    extends BaseState<MainPage,MainPresenter>
                               ^^^^^^^^^^^^^
../lib/page/MainPage.dart:117:3: Error: Type 'MainPresenter' not found.
  MainPresenter createPresenter()  => MainPresenter();
  ^^^^^^^^^^^^^
../lib/page/MainPage.dart:37:7: Error: Type argument 'invalid-type' doesn't conform to the bound 'BasePresenter<BaseView>' of the type variable 'P' on 'BaseState' in the supertype 'BaseState' of class 'BaseState with AutomaticKeepAliveClientMixin'.
 - 'BasePresenter' is from 'package:module_common/page/BasePresenter.dart' ('lib/page/BasePresenter.dart').
 - 'BaseView' is from 'package:module_common/page/BaseView.dart' ('lib/page/BaseView.dart').
Try changing type arguments so that they conform to the bounds.
class MainPageState
      ^
lib/page/BaseState.dart:11:51: Context: This is the type variable whose bound isn't conformed to.
abstract class BaseState<T extends StatefulWidget,P extends BasePresenter> extends State<T>  implements BaseView{
                                                  ^
../lib/page/MainPage.dart:117:39: Error: The method 'MainPresenter' isn't defined for the class 'MainPageState'.
 - 'MainPageState' is from '../lib/page/MainPage.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'MainPresenter'.
  MainPresenter createPresenter()  => MainPresenter();
                                      ^^^^^^^^^^^^^
../lib/page/MainPage.dart:131:10: Error: 'AppBarConfig' isn't a type.
    List<AppBarConfig> lst = presenter
         ^^^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartl
ang-untranslatable-uri:package:dreaming_application/page/MainPresenter.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_
f
ile_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:567:37)
#2      writeDepfile (package:vm/kernel_front_end.dart
:760:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:539:15)
<asynchronous sus
pension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22)
#5      starter (package:flutter_frontend_server/server.dart:178:27)
#6      main (file:///C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7      _startIsola
te.<
anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'E:\My_Developments\Android\SDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':common:compileFlutterBuildDebug'.
> Process 'command 'E:\My_Developments\Android\SDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
Exception: Gradle task assembleDebug failed with exit code 1

end error log
---------------------------------------------------------------------

here's the project structure:
--
dreaming_application(Flutter Project)
--module_common(Flutter Project)
--module_mine(Flutter Project)
and more ....


end project structure
--
MainPresenter.dart
--
import 'dart:convert';
import 'dart:io';

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:sprintf/sprintf.dart';

import 'package:module_config/bean/UserBean.dart';
import 'package:module_config/ConfigManager.dart';
import 'package:module_mine/page/MinePage.dart';
import 'package:module_common/page/BasePresenter.dart';
import 'package:module_common/page/NetWebPage.dart';
import 'package:module_utils/helper/PlatformHelper.dart';
import 'package:module_utils/tools/Log.dart';
import 'package:module_utils/tools/StringBuilder.dart';

import 'package:dreaming_application/page/MainPage.dart';

class MainPresenter extends BasePresenter<MainPageState>{
...
...
}

end MainPresenter.dart
--

MainPage.dart
--
import 'dart:io';

import 'package:module_common/annotations/AutoRoute.dart';
import 'package:module_common/annotations/Description.dart';
import 'package:module_common/page/BaseState.dart';

import 'package:module_config/ConfigManager.dart';

import 'package:module_utils/core/RouterManager.dart';
import 'package:module_utils/tools/ColorUtils.dart';
import 'package:module_utils/tools/DeviceInfoUtils.dart';
import 'package:module_utils/tools/Log.dart';
import 'package:module_utils/tools/Toast.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:dreaming_application/page/MainPresenter.dart';

class MainPage extends StatefulWidget {
...
}

class MainPageState
    extends BaseState<MainPage,MainPresenter>
    with AutomaticKeepAliveClientMixin{
...
}


@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Aug 30, 2021
@darshankawar
Copy link
Member

@isong0623
Please ask support questions on StackOverflow, as this doesn't seem to be a framework related but code / setup.
Closing from here. If you think this is a framework issue, write in comments and I'll reopen it.

@darshankawar darshankawar added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Aug 30, 2021
@isong0623
Copy link
Author

I think this is a syntax compiler error.
I don't have enough time to figure out how the syntax compiler works.

If you have time, I hope you can follow up. Thanks.

@isong0623
Copy link
Author

@darshankawar
Copy link
Member

Looking at the exception you are getting:

Unhandled exception:
FileSystemException(uri=org-dartl
ang-untranslatable-uri:package:dreaming_application/page/MainPresenter.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_
f
ile_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:567:37)
#2      writeDepfile (package:vm/kernel_front_end.dart
:760:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:539:15)
<asynchronous sus
pension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:40:22)
#5      starter (package:flutter_frontend_server/server.dart:178:27)
#6      main (file:///C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)
#7      _startIsola
te.<
anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

It could be related to dart and not Flutter framework. Please report this issue in dedicated repo: https://github.com/dart-lang/sdk/issues
I see a similar open issue describing same exception in it: dart-lang/sdk#36481

@isong0623
Copy link
Author

I fixed this problem, you can run that demo at first commit. https://github.com/isong0623/compile_error_demo @darshankawar
Besides the dependencies between the Flutter projects, the most immediate reason is that the Android projects also have dependencies.
Now that Android is not completely dependent, a lot of files are not packaged, which drives me crazy.

At present, I plan to rebuild these projects into an independent FLUTTER project. Thank you for your answer.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

2 participants