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

Transformer terminated unexpectedly #16

Closed
Kila2 opened this issue Sep 26, 2019 · 2 comments
Closed

Transformer terminated unexpectedly #16

Kila2 opened this issue Sep 26, 2019 · 2 comments

Comments

@Kila2
Copy link

Kila2 commented Sep 26, 2019

These methods cause "Transformer terminated unexpectedly" when run command

flutter build ios
@Execute("package:flutter/src/gestures/recognizer.dart", "GestureRecognizer",
      "-invokeCallback")
@pragma("vm:entry-point")
dynamic hookInvokeCallback(PointCut pointcut) {
  return pointcut.proceed();
}

@Execute("package:flutter/src/material/ink_well.dart", "_InkResponseState",
    "-_handleTap")
@pragma("vm:entry-point")
Widget hook_handleTap(PointCut pointcut) {
  Widget res = pointcut.proceed();
  return res;
}

@Execute("package:flutter/src/widgets/routes.dart", "RouteObserver",
    "-didPush")
@pragma("vm:entry-point")
void hookDidPush(PointCut pointcut) {
  pointcut.proceed();
}

@Execute(
    "package:flutter/src/widgets/routes.dart", "RouteObserver", "-didPop")
@pragma("vm:entry-point")
//pop
void hookDidPop(PointCut pointcut) {
  pointcut.proceed();
}
@Kila2 Kila2 changed the title The GestureRecognizer.invokeCallback method cause "Transformer terminated unexpectedly" Transformer terminated unexpectedly Sep 26, 2019
@kangwang1988
Copy link
Contributor

kangwang1988 commented Oct 8, 2019

@Kila2
Using latest flutter(master) and aspectd(master),

kylewong@KyleWongdeMacBook-Pro vm % flutter doctor -v
[✓] Flutter (Channel master, v1.10.14-pre.12, on Mac OS X 10.15 19A582a, locale en-CN)
    • Flutter version 1.10.14-pre.12 at /Users/kylewong/Codes/Flutter/alibaba-flutter/flutter
    • Framework revision cdc2d9901d (8 hours ago), 2019-10-07 16:43:04 -0700
    • Engine revision 1d62160fdb
    • Dart version 2.6.0 (build 2.6.0-dev.1.0 d6c6d12ebf)

[✓] 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.2
    • 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 11.2)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Xcode 11.2, Build version 11B41
    ! 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

[✓] 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)

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

[✓] Connected device (2 available)
    • MHA AL00       • xxx                         • android-arm64 • Android 9 (API 28)
    • “L”的 iPhone • xxx • ios           • iOS 12.4.1

I wrote a aspectd_impl package under flutter_gallery with codes below:
flutter_gallery/aspectd_impl/lib/aspectd_impl.dart

import 'package:flutter_gallery/main.dart' as app;
import 'aop_impl.dart';

void main()=> app.main();

flutter_gallery/aspectd_impl/lib/aop_impl.dart

import 'package:aspectd/aspectd.dart';
import 'package:flutter/material.dart';

@Aspect()
@pragma("vm:entry-point")
class ExecuteDemo {
  @pragma("vm:entry-point")
  ExecuteDemo();

  @Execute("package:flutter/src/gestures/recognizer.dart", "GestureRecognizer",
      "-invokeCallback")
  @pragma("vm:entry-point")
  dynamic hookInvokeCallback(PointCut pointcut) {
    print('[KWLM]1:Called!');
    return pointcut.proceed();
  }

  @Execute("package:flutter/src/material/ink_well.dart", "_InkResponseState",
      "-_handleTap")
  @pragma("vm:entry-point")
  Widget hook_handleTap(PointCut pointcut) {
    print('[KWLM]2:Called!');
    Widget res = pointcut.proceed();
    return res;
  }

  @Execute("package:flutter/src/widgets/routes.dart", "RouteObserver",
      "-didPush")
  @pragma("vm:entry-point")
  void hookDidPush(PointCut pointcut) {
    print('[KWLM]3:Called!');
    pointcut.proceed();
  }

  @Execute(
      "package:flutter/src/widgets/routes.dart", "RouteObserver", "-didPop")
  @pragma("vm:entry-point")
//pop
  void hookDidPop(PointCut pointcut) {
    print('[KWLM]4:Called!');
    pointcut.proceed();
  }
}

It works fine in both ios/android(debug/release mode).

Screen Shot 2019-10-08 at 3 29 53 PM

I'm closing this issue now, if you can reproduce it using latest flutter/aspectd(master), feel free to comment and i will reopen it.

@kangwang1988
Copy link
Contributor

Update:
After an offline communication, this issue is finally resolved by adding a default constructor.
I also update the README in 84dc3ff

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