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

aspectd对flutter module不生效 #8

Closed
galaxybruce opened this issue Aug 26, 2019 · 6 comments
Closed

aspectd对flutter module不生效 #8

galaxybruce opened this issue Aug 26, 2019 · 6 comments

Comments

@galaxybruce
Copy link

aspectd对一个纯flutter工程是生效的,但是对混编的下的flutter module不生效。下面是我的项目截图:
image
aspectd.dart.snapshot也生成了
image

@kangwang1988
Copy link
Contributor

image

@kangwang1988
Copy link
Contributor

@galaxybruce
I've verified aspectd in a flutter module with flutter below, it works fine:

kylewong@KyleWongdeMacBook-Pro vm % flutter doctor -v
[✓] Flutter (Channel master, v1.9.6-pre.6, on Mac OS X 10.15 19A536g, locale en-CN)
    • Flutter version 1.9.6-pre.6 at /Users/kylewong/Codes/Flutter/alibaba-flutter/flutter
    • Framework revision d37a38cee1 (20 hours ago), 2019-08-25 10:57:54 -0700Engine revision deca2c0da8
    • Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/kylewong/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2Java binary at: /Users/kylewong/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.5791312/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 11.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/DeveloperXcode 11.0, Build version 11M382q
    ! Unknown CocoaPods version installed.
        Flutter is unable to determine the installed CocoaPods's version.
        Ensure that the output of 'pod --version' contains only digits and . to be
        recognized by Flutter.
      To upgrade:
        sudo gem install cocoapods
        pod setup

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

[✓] Android Studio (version 3.5)
    • Android Studio at /Users/kylewong/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.5791312/Android
      Studio.app/Contents
    • Flutter plugin version 38.2.3
    • Dart plugin version 191.8405
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[✓] Connected device (1 available)

@galaxybruce
Copy link
Author

@kangwang1988
看了你的截图,我有几个 问题想你帮我明确下:

  1. 此时的aop应该是flutter project吧,不是文档中所说的flutter package?
  2. aop/pubspec.yaml是怎样的?可以截个图看下吗。我这里aspected找不到,必须把aspected的依赖放在我的flutter module/pubspec.yaml才行
    image

@kangwang1988
Copy link
Contributor

@galaxybruce
aop是个flutter package,不是project,你看到的iOS/Android两个文件夹是因为自动生成造成的。
aop整个内容就是我git上贴的内容,具体参见:
https://github.com/alibaba-flutter/aspectd/blob/master/example/aop/pubspec.yaml

这里有个问题就是说你不管是标准flutter工程的引入,还是module这种场景下的引入,其实flutter project和aop package都是flutter包裹了aop package。在构建flutter project的时候,如果你成功应用了aspectd的patch,那么构建过程中就会检查当前flutter项目的根目录下是否存在aop这个包,有的话就会使用它去构建,这样就可以将aop代码打入dill并且通过transformer做变换。所以标准flutter工程和module引入逻辑和原理都应该是一样的。

aspectd的依赖找不到,就说明你需要在路径放置ok了之后执行flutter packages get获取依赖哈。

@galaxybruce
Copy link
Author

@kangwang1988
flutter packages get命令执行过,.packages中可以看到是成功下载的。但是aop package如果单独用android studio打开或者放在flutter project中,aop_impl.dart是可以找到aspected,但是放在flutter module中就不行。
image

@galaxybruce
Copy link
Author

@kangwang1988
flutter packages get命令执行过,.packages中可以看到是成功下载的。但是aop package如果单独用android studio打开或者放在flutter project中,aop_impl.dart是可以找到aspected,但是放在flutter module中就不行。
image

这个demo中,这种情况可能不是问题,虽然编译不通过,但是运行结果是正常的。
我的自己的项目比较复杂,我再去找找问题。
@kangwang1988 谢谢!

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

2 participants