Skip to content

[Android] 11.0.0 build fails — cannot find symbol FilePickerPlugin (missing kotlin-android plugin) #1973

Description

@mfurkanyuceal

Description

Upgrading to file_picker: 11.0.0 causes an Android build failure. The GeneratedPluginRegistrant.java cannot resolve FilePickerPlugin because the Kotlin Android plugin is not applied in the package's android/build.gradle.

This is the same root cause as the regression in 10.3.9 (fixed in 10.3.10), but the fix was not carried into the 11.0.0 release.

Related: #1952 (maintainer requested a new issue in this comment)

Error

GeneratedPluginRegistrant.java:64: error: cannot find symbol
    flutterEngine.getPlugins().add(new com.mr.flutter.plugin.filepicker.FilePickerPlugin());
                                                                       ^
  symbol:   class FilePickerPlugin
  location: package com.mr.flutter.plugin.filepicker
1 error

FAILURE: Build failed with an exception.
Execution failed for task ':app:compileDebugJavaWithJavac'.

Root Cause

file_picker 11.0.0's android/build.gradle applies only com.android.library but does not apply kotlin-android. All Android source files are Kotlin (.kt), so without this plugin Gradle never compiles them — the Java-side GeneratedPluginRegistrant then fails to find the class.

11.0.0 (build.gradle):

apply plugin: 'com.android.library'
// ❌ missing: apply plugin: 'kotlin-android'

10.3.10 (build.gradle) — working:

apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'  //

Steps to Reproduce

  1. Set file_picker: 11.0.0 in pubspec.yaml
  2. Run flutter clean && flutter pub get
  3. Run flutter run targeting an Android device
  4. Build fails at :app:compileDebugJavaWithJavac

Downgrading to 10.3.10 resolves the issue immediately.

Environment

  • Flutter: 3.41.0 (Dart SDK 3.11.1)
  • file_picker: 11.0.0
  • AGP: 8.13.0
  • Kotlin: 2.2.20
  • Gradle: (via Flutter)
  • Java: 17
  • OS: macOS Darwin 25.4.0
  • Device: Samsung SM-M215F (Android, debug mode)

Suggested Fix

Add the missing Kotlin plugin to android/build.gradle:

  apply plugin: 'com.android.library'
+ apply plugin: 'org.jetbrains.kotlin.android'

And optionally restore kotlinOptions:

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_17.toString()
}

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