flutter_gamepad
flutter_gamepad copied to clipboard
Android build fails
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (23, 95): No value passed for parameter 'p1'
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (33, 124): Type mismatch: inferred type is KeyEventChannel but View was expected
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (33, 141): Type mismatch: inferred type is TextInputPlugin but KeyEventChannel was expected
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (33, 156): No value passed for parameter 'p2'
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (34, 18): Return type of 'onKeyDown' is not a subtype of the return type of the overridden member 'public open fun onKeyDown(@NonNull p0: KeyEvent): Boolean defined in io.flutter.embedding.android.AndroidKeyProcessor'
e: /Users/jstillwell/Code/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_gamepad-0.3.2/android/src/main/kotlin/com/example/flutter_gamepad/FlutterGamepadPlugin.kt: (41, 18): Return type of 'onKeyUp' is not a subtype of the return type of the overridden member 'public open fun onKeyUp(@NonNull p0: KeyEvent): Boolean defined in io.flutter.embedding.android.AndroidKeyProcessor'
FAILURE: Build failed with an exception.
Latest Android Studio.
Very simple project that just uses your example code.
MacOS
@dragonfax Here's what you can do as a temporary measure:
- Fork the flutter_gamepad package.
- From the Android part of the package remove all code that causes problems and leave just barebones skeleton of the plugin (or "do nothing plugin") so that it registers instead of throwing an exception (which is what happens if you remove everything) when your app loads.
- Use the functionality provided by the package for iOS only
- Use RawKeyboardListener on Android as it can handle all the keys from gamepad controllers (RawKeyboardListener functionality is not implemented on iOS).
I'm trying to use this on Android.
Go for RawKeyboardListener then! It has it all.
@dragonfax: Does the example app build for you?
Oh I think perhaps we just haven't updated pub.dev in a while. The latest code in the master branch of our repo will build though.
The example in the master branch doesn't compile either. I get the same error messages as dragonfax.
https://github.com/flutter/flutter/issues/50789#issuecomment-870514415