Skip to content

Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected #22

@Sun3

Description

@Sun3

By using the Flutter 1.12.13+hotfix.5 • channel stable and creating a New Application then add this library you run into errors because of the changes in v1.12 for plugins.

Steps to reproduce with Flutter 1.12.13+hotfix.5 • channel stable:

  1. Create a New Flutter Project with default checkboxes checked for AndroidX, Include Kotlin and Include Swift
  2. Add to the pubspec.yaml file the plugin native_audio: ^0.0.14
  3. Open the Android project in Android Studio and add the 1. Application and 2. Service & Permissions instructions for the native_audio plugin
    -. Add the Application.kt file
  • Modify the AndroidMainfest.xml file and change the android:name=".Application"
  • Add the full <receiver> and <service>, the <uses-permissions>
  1. Run the Flutter project and you receive the following error.
e: C:\Users\dev\Downloads\Flutter-Audio-Test-Projects\native_audio_test2\android\app\src\main\kotlin\com\company\native_audio_test2\Application.kt: (16, 48): Type mismatch: inferred type is PluginRegistry but FlutterEngine was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 12s
Finished with error: Gradle task assembleDebug failed with exit code 1

Flutter Doctor:

C:\Users\dev\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
    • Flutter version 1.12.13+hotfix.5 at C:\Users\marco\flutter
    • Framework revision 27321ebbad (13 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\marco\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.41.1)
    • VS Code at C:\Users\marco\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.7.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
Process finished with exit code 0

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions