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

Building this project on newer version of flutter is utterly broken #2

Closed
hungrymonkey opened this issue Jan 1, 2019 · 10 comments
Closed

Comments

@hungrymonkey
Copy link
Owner

Issue # 16441 one offical flutter page.

@hungrymonkey hungrymonkey changed the title I may need to recreate this whole project from scratch. Building this project on newer version of flutter is utterly broken Jan 1, 2019
@hungrymonkey
Copy link
Owner Author

To whoever attempts to build this project, I did try to update flutter decencies versions. However, android build is also broken too.
I do not think the flutter team created an upgrade path from alpha versions. Since this plugin uses native android code, this plugin is pretty difficult to rebuild from scratch from two flutter creates.

@hungrymonkey
Copy link
Owner Author

I created a branch which clearly shows the issue
https://github.com/hungrymonkey/mic_stream/tree/issue_2

flutter build apk
Initializing gradle...                                       0.8s
Resolving dependencies...                                        
* Error running Gradle:
ProcessException: Process
"/Users/psuedofinnish/git_repo/mic_stream/example/android/gradlew" exited
abnormally:

Deprecated Gradle features were used in this build, making it incompatible with
Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See
https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command
_line_warnings


FAILURE: Build failed with an exception.

* Where:
Build file
'/Users/psuedofinnish/git_repo/mic_stream/example/android/build.gradle' line: 23

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not resolve all dependencies for configuration ':app:_debugApk'.
      > A problem occurred configuring project ':mic_stream'.
         > Failed to notify project evaluation listener.
            >
            com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDepende
            ncyCacheDir(Ljava/io/File;)V

* 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 0s
  Command: /Users/psuedofinnish/git_repo/mic_stream/example/android/gradlew
  app:properties


Please review your Gradle project setup in the android/ folder.

@hungrymonkey
Copy link
Owner Author

Official # 16215
I will take a look at the official workaround. I do not use the official Android Studio Application. I guess I will have to open it

@hungrymonkey
Copy link
Owner Author

Official pr # 18071

@hungrymonkey
Copy link
Owner Author

In addition to fixing gradle,

Compiler message:
file:///Users/psuedofinnish/git_repo/mic_stream/lib/mic_stream.dart:26:14: Error: The top level function has type '(dart.typed_data::Uint8List) → #lib1::MicEvent' that isn't of expected type '(dynamic) → #lib1::MicEvent'.
Change the type of the function or the context in which it is used.
        .map(_createEvent);
             ^
file:///Users/psuedofinnish/git_repo/mic_stream/lib/mic_stream.dart:34:14: Error: The top level function has type '(dart.typed_data::Uint8List) → #lib1::MicEvent' that isn't of expected type '(dynamic) → #lib1::MicEvent'.
Change the type of the function or the context in which it is used.
        .map(_createFFTEvent);
             ^
lib/utils.dart:7:25: Error: Getter not found: 'INFINITY'.
    num minVal = double.INFINITY;
                        ^^^^^^^^
lib/utils.dart:18:25: Error: Getter not found: 'NEGATIVE_INFINITY'.
    num maxVal = double.NEGATIVE_INFINITY;
                        ^^^^^^^^^^^^^^^^^
file:///Users/psuedofinnish/git_repo/mic_stream/lib/utils.dart:36:27: Error: Method not found: 'Window.Hann'.
    var windowed = Window.Hann(audioFloats);
                          ^^^^
Compiler terminated unexpectedly.

Dart compiler needs to be updated.

@hungrymonkey
Copy link
Owner Author

The project builds but I will have to test it on a real device
https://github.com/hungrymonkey/mic_stream/tree/issue2_attempt1
I am having trouble interfacing with adb. I need to build this project on my old computer.

@hungrymonkey
Copy link
Owner Author

The last bug was a runtime bug.

E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): Failed to handle method call
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.notImplemented(MethodChannel.java:213)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at com.yourcompany.micstreamexample.MainActivity$1.onMethodCall(MainActivity.java:35)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at android.os.Looper.loop(Looper.java:136)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at android.app.ActivityThread.main(ActivityThread.java:6119)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
E/MethodChannel#com.yourcompany.flutter/audioFragmentPlayer(11477): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
E/FlutterNativeView(11477): Uncaught exception in binary message listener
E/FlutterNativeView(11477): java.lang.IllegalStateException: Reply already submitted
E/FlutterNativeView(11477): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/FlutterNativeView(11477): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:218)
E/FlutterNativeView(11477): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/FlutterNativeView(11477): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/FlutterNativeView(11477): 	at android.os.MessageQueue.next(MessageQueue.java:323)
E/FlutterNativeView(11477): 	at android.os.Looper.loop(Looper.java:136)
E/FlutterNativeView(11477): 	at android.app.ActivityThread.main(ActivityThread.java:6119)
E/FlutterNativeView(11477): 	at java.lang.reflect.Method.invoke(Native Method)
E/FlutterNativeView(11477): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
E/FlutterNativeView(11477): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I needed to add return statements to onMethodCall

public void onMethodCall(MethodCall call, Result result) {
          if (call.method.equals("play")) {
            byte[] args =  call.arguments();
            fPlayer.play(args);
            result.success(1);
            return;
          } if(call.method.equals("stop")) {
            fPlayer.stop();
            result.success(1);
            return;
          } else {
            result.notImplemented();
            return;
          }
        }

@hungrymonkey
Copy link
Owner Author

ef34ea5

@ibartj
Copy link

ibartj commented Feb 2, 2019

Thank you! Thank you! Thank you! It works, now. 👍

@hungrymonkey
Copy link
Owner Author

hungrymonkey commented Feb 2, 2019

@ibartj No problem, I think there was a few changes to android studio which allow me to fix this bug.
I think I remember I attempted to fix the issue when I opened the bug, but android build system is just fragile.

Master should work with Flutter stable

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