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

demo运行没效果(Problem running the aop project) #26

Closed
hhh123hh opened this issue Oct 28, 2019 · 24 comments
Closed

demo运行没效果(Problem running the aop project) #26

hhh123hh opened this issue Oct 28, 2019 · 24 comments

Comments

@hhh123hh
Copy link

print('[KWLM]:onPluginDemo Called!');

demo运行只打了这一行log

@kangwang1988
Copy link
Contributor

请依次确认一下步骤:

  1. 使用了最新的master代码(flutter&aspectd)
  2. 成功应用了patch并且重新构建了flutter_tools(需要rm bin/cache/flutter_tools.stamp)
  3. 查看工程中使用的aspectd目录下的snapshot文件夹下aspectd.dart.snapshot成功生成
    理论上来说,依赖获取成功的情况下(自动获取,但你需要手动获取example和aspectd_impl的依赖),在你的~/.pub-cache目录下dart-sdk的源代码需要被完整依赖,结果如下:

Screen Shot 2019-10-28 at 3 14 15 PM

如果你确定上述流程和内容都存在,但是结果依然没有,那么请将 ```shell flutter run --release --verbose ``` 的详细结果贴到下方。

@hhh123hh

@Ivonhoe
Copy link

Ivonhoe commented Oct 28, 2019

@kangwang1988 遇到类似的问题

  1. 已更新最新master代码
  2. 已应用patch并rm flutter_tools.stamp
  3. 问题出在第三项,/Users/Ivonhoe/Flutter/flutter/.pub-cache/git/aspectd481463039cad1205ee94738b564f83a3861目录下没有生成aspectd.dart.snapshot
    执行flutter run --debug --verbose命令发现卡在在aspectd.dart generateAspectdSnapshot方法中。
    image

@Ivonhoe
Copy link

Ivonhoe commented Oct 28, 2019

--verbosity=warning 这个命令参数是不是已经过期了?在/Users/Ivonhoe/Flutter/flutter/.pub-cache/git/aspectd-481463039cad1205ee94738b564f83a386165cfe 目录底下执行 flutter pub get显示:
image

### flutter version -v

[✓] Flutter (Channel master, v1.10.15-pre.271, on Mac OS X 10.13.6 17G7024, locale zh-Hans-CN)
• Flutter version 1.10.15-pre.271 at /Users/Ivonhoe/Flutter/flutter
• Framework revision 80b526ea62 (2 days ago), 2019-10-26 01:18:06 -0400
• Engine revision 3ebf006904
• Dart version 2.6.0 (build 2.6.0-dev.8.2 6354b0b97d)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/Ivonhoe/Library/Android/sdk
• Android NDK at /Users/Ivonhoe/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/Ivonhoe/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Flutter requires a minimum Xcode version of 10.2.0.
Download the latest version or update via the Mac App Store.
! CocoaPods 1.5.3 out of date (1.6.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to
your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade:
sudo gem install cocoapods

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.2.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] VS Code (version 1.39.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.5.1

[✓] Connected device (1 available)
• Moto Z • ZY223JQ8P5 • android-arm64 • Android 9 (API 28)

@kangwang1988
Copy link
Contributor

@Ivonhoe 没有过期,你所看到的正常那个的。
如果你在aspectd的目录下执行了这个get,那么再次运行还可以正常生成aspectd.dart.snapshot么?

@Ivonhoe
Copy link

Ivonhoe commented Oct 29, 2019

@kangwang1988 在.pub-cache/git/aspectd-481463039cad1205ee94738b564f83a386165cfe目录下执行flutter pub get是成功的,但是有红色警告。执行pub get 一直提示Resolving dependencies....

image

@kangwang1988
Copy link
Contributor

kangwang1988 commented Oct 29, 2019

@Ivonhoe

    --verbosity        Control output verbosity.

          [all]        Show all output including internal tracing messages.
          [error]      Show only errors.
          [io]         Also show IO operations.
          [normal]     Show errors, warnings, and user messages.
          [solver]     Show steps during version resolution.
          [warning]    Show only errors and warnings.

-v, --verbose          Shortcut for "--verbosity=all".

试试

pub get --verbosity=all

看看卡在哪里了。

@hhh123hh
Copy link
Author

flutter1.9.1版本
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/aspectd.dart' cleanly.
error: patch failed: packages/flutter_tools/lib/src/commands/build_aot.dart:5
Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/commands/build_aot.dart' cleanl
y.
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:4

Falling back to three-way merge...
Applied patch to 'packages/flutter_tools/lib/src/commands/build_bundle.dart' cle
anly.

@hhh123hh
Copy link
Author

@kangwang1988
换成1.7.8也报错,不是flutter目录下执行就可以吗?
error: patch failed: packages/flutter_tools/lib/src/commands/build_aot.dart:5
error: repository lacks the necessary blob to fall back on 3-way merge.
error: packages/flutter_tools/lib/src/commands/build_aot.dart: patch does not ap
ply
error: patch failed: packages/flutter_tools/lib/src/commands/build_bundle.dart:1
40
error: repository lacks the necessary blob to fall back on 3-way merge.
error: packages/flutter_tools/lib/src/commands/build_bundle.dart: patch does not
apply

@kangwang1988
Copy link
Contributor

@hhh123hh 1.7.8的问题参见#5

@hhh123hh
Copy link
Author

@kangwang1988 1.7.8可以了。
aspectd:
git:
url: [email protected]:alibaba-flutter/aspectd.git
ref: master
这个有本地依赖吗?下载的代码里面有没有

@hhh123hh
Copy link
Author

@kangwang1988 第3步没有生成,前面的步骤可以了

@kangwang1988
Copy link
Contributor

@hhh123hh 你的dart-sdk完整获取下来了么?

@hhh123hh
Copy link
Author

flutter_windows_v1.7.8+hotfix.4-stable\flutter.pub-cache\git\aspectd-481463039cad1205ee94738b564f83a386165cfe\snapshot这个文件夹下面是空的

@kangwang1988
Copy link
Contributor

@hhh123hh 有一个逻辑,就是patch后的flutter工具会去修改你的aspectd中pubspec.yaml里面的依赖
https://github.com/alibaba-flutter/aspectd/blob/master/pubspec.yaml
然后会对你的aspectd,也就是你列出来的这个库执行pub get命令,这个命令执行过程中会去拉下来整个dart-sdk的源代码,之后利用这个源代码,才能生成aspectd.dart.snapshot,所以你得先确认dart-sdk是否成功获取了。

@hhh123hh
Copy link
Author

这个是有的
kk_image

@kangwang1988
Copy link
Contributor

kangwang1988 commented Oct 31, 2019

@hhh123hh 可能我没说明白,我说的是整个dart sdk的源代码,而不是你现在看到的dart-sdk对外提供的内容,这部分flutter自动下载的。你应该关注的目录是各种依赖下载后的cache目录,在windows10我的设备上,我看到的目录是: C:\Users\KyleWong\AppData\Roaming\Pub\Cache\hosted
我说的是这一块依赖获取的完整性,这是在一个完整的Flutter获取完毕之后(包括你贴出来的dart_sdk)之后才执行获得的。

@hhh123hh
Copy link
Author

hhh123hh commented Nov 1, 2019

kk_image

你的目录和我这里的可能不一样,依赖库下载的cache在这个里面

@hhh123hh
Copy link
Author

hhh123hh commented Nov 1, 2019

kk_image
@kangwang1988

@kangwang1988
Copy link
Contributor

kangwang1988 commented Nov 2, 2019

@hhh123hh dart sdk是通过git引入的,所以你应该要看hosted的同级目录下的git文件夹。
image

@kangwang1988 kangwang1988 changed the title demo运行没效果 demo运行没效果(Problem running the aop project) Nov 11, 2019
@kangwang1988
Copy link
Contributor

kangwang1988 commented Nov 11, 2019

I've received several reports about the failure when running demo project provided in aspectd package. There are several things I would like to share.

a. Version issue

I'm trying to keep aspectd compatible with flutter in the master branch.
In other words, the latest commit of aspectd(master branch) is expected to work fine with the latest commit of flutter(master branch).
If you're facing some problems, please upgrade to the latest commit of master branch or provide detailed result of the flutter doctor -v command so I might diagnose with a better clue.

b. Diagnosing procedures with aspectd(master) and flutter(master).

b.1 Please make sure that you're using the latest commit of aspectd and flutter

b.2 Patch the flutter git repository with the patch provided in aspectd:

git apply --3way /Users/kylewong/Codes/Flutter/alibaba-flutter/aspectd/0001-aspectd.patch

b.3 Remove the flutter tools snapshot and rebuild it

kylewong@KyleWongdeMacBook-Pro flutter % rm bin/cache/flutter_tools.stamp 
kylewong@KyleWongdeMacBook-Pro flutter % bin/flutter doctor -v
Building flutter tool...

b.4 Upgrade the dependencies for package example(aspectd/example) and aspectd_impl(aspectd/example/aspectd_impl)

kylewong@KyleWongdeMacBook-Pro example % pwd
/Users/kylewong/Codes/Flutter/alibaba-flutter/aspectd/example
kylewong@KyleWongdeMacBook-Pro example % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/flutter packages upgrade
Running "flutter pub upgrade" in example...                         2.5s
kylewong@KyleWongdeMacBook-Pro example % cd aspectd_impl 
kylewong@KyleWongdeMacBook-Pro aspectd_impl % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/flutter packages upgrade
Running "flutter pub upgrade" in aspectd_impl...                    2.7s

b.5 Run flutter in the example folder

kylewong@KyleWongdeMacBook-Pro example % pwd
/Users/kylewong/Codes/Flutter/alibaba-flutter/aspectd/example
kylewong@KyleWongdeMacBook-Pro example % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/flutter run --release --verbose

When b.5 is executed and the aop code is not working as expected, you should check following steps below:

b.6 The pubspec.yaml is expected to specifying the dart-sdk dependency corresponding to the dart version use in your flutter repo.

# dart-sdk using by flutter repo
kylewong@KyleWongdeMacBook-Pro example % cat /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/cache/dart-sdk/revision    
d45c3d15cb3cea0104a87697c085259666eec528(It could vary on different flutter version)

Screen Shot 2019-11-11 at 2 42 03 PM

b.7 The dart-sdk(git repo instead of the flutter/bin/cache/dart-sdk) is expected to be fetched successfully in git form

Screen Shot 2019-11-11 at 2 45 43 PM

Pay attention that the pub-cache repo could vary on different operating system.

b.8 The aspectd/pubspec.lock is expected to be deleted and regenerated automatically.
If not, please make sure your network connection is fine.

b.9 The aspectd/snapshot/aspectd.dart.snapshot is expected to be generated

If not, please run command below to see what's wrong with it.

kylewong@KyleWongdeMacBook-Pro aspectd % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/cache/dart-sdk/bin/dart --snapshot=snapshot/aspectd.dart.snapshot tool/starter.dart

b.10 Paste the full log for commands below so I will check what's happening:

kylewong@KyleWongdeMacBook-Pro aspectd % cd example 
kylewong@KyleWongdeMacBook-Pro example % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/flutter doctor -v
kylewong@KyleWongdeMacBook-Pro example % /Users/kylewong/Codes/Flutter/alibaba-flutter/GithubMaster/flutter/bin/flutter run --release --verbose

@kangwang1988
Copy link
Contributor

FYI @maheshmnj

@maheshj01
Copy link

FYI @maheshmnj

Thanks for the info I will try the above and I will let you know

@maheshj01
Copy link

@kangwang1988 heres my flutter doctor -v output

[✓] Flutter (Channel stable, v1.9.1+hotfix.6, on Mac OS X 10.14.6 18G103, locale en-IN)
    • Flutter version 1.9.1+hotfix.6 at /Users/almac03/Documents/flutter
    • Framework revision 68587a0916 (8 weeks ago), 2019-09-13 19:46:58 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/almac03/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.0, Build version 11A420a
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.40.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.6.0

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • B1D782BE-C888-47D1-9BF7-91F523DF5A68 • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)

• No issues found!

@kangwang1988
Copy link
Contributor

Duplicate of #5
Closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants