Skip to content

[firebase_ai]: Android compilation failure #18138

@raph5640

Description

@raph5640

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Analytics, Cloud Functions

Which platforms are affected?

Android

Description

What happened
When building an Android release bundle the Java compilation step fails with multiple cannot find symbol errors that originate from the generated file android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java. The file contains calls to plugin classes such as:

io.flutter.plugins.firebase.functions.FlutterFirebaseFunctionsPlugin
io.flutter.plugins.firebase.ai.FirebaseAIPlugin
io.flutter.plugins.firebase.analytics.FlutterFirebaseAnalyticsPlugin
io.flutter.plugins.firebase.performance.FlutterFirebasePerformancePlugin
io.flutter.plugins.firebase.firebaseremoteconfig.FirebaseRemoteConfigPlugin
io.flutter.plugins.firebase.storage.FlutterFirebaseStoragePlugin

However javac reports cannot find symbol for each class even though the corresponding Kotlin source files exist in the pub cache.

What I expected
The Android build should complete. GeneratedPluginRegistrant.java should be able to compile because the native plugin classes should be available on the Java compile classpath.

What actually happened
Compilation fails at :app:compileReleaseJavaWithJavac with the above cannot find symbol errors. The Kotlin implementations exist in the pub cache, but they are not visible to the Java compiler at compile time.

Reproducing the issue

cd flutter/android && gradlew.bat --stop && cd .. && flutter clean && flutter pub get && flutter build appbundle --release
Observe failure at :app:compileReleaseJavaWithJavac.

Firebase Core version

4.6.0

Flutter Version

3.41.5

Relevant Log Output

C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:39: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.functions.FlutterFirebaseFunctionsPlugin());
                                                                              ^
  symbol:   class FlutterFirebaseFunctionsPlugin
  location: package io.flutter.plugins.firebase.functions
C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:59: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.ai.FirebaseAIPlugin());
                                                                       ^
  symbol:   class FirebaseAIPlugin
  location: package io.flutter.plugins.firebase.ai
C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:64: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.analytics.FlutterFirebaseAnalyticsPlugin());
                                                                              ^
  symbol:   class FlutterFirebaseAnalyticsPlugin
  location: package io.flutter.plugins.firebase.analytics
C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:99: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.performance.FlutterFirebasePerformancePlugin());
                                                                                ^
  symbol:   class FlutterFirebasePerformancePlugin
  location: package io.flutter.plugins.firebase.performance
C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:104: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.firebaseremoteconfig.FirebaseRemoteConfigPlugin());
                                                                                         ^
  symbol:   class FirebaseRemoteConfigPlugin
  location: package io.flutter.plugins.firebase.firebaseremoteconfig
C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:109: error: cannot find symbol
      flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.storage.FlutterFirebaseStoragePlugin());
                                                                            ^
  symbol:   class FlutterFirebaseStoragePlugin
  location: package io.flutter.plugins.firebase.storage
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler output below.
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:39: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.functions.FlutterFirebaseFunctionsPlugin());
                                                                                ^
    symbol:   class FlutterFirebaseFunctionsPlugin
    location: package io.flutter.plugins.firebase.functions
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:59: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.ai.FirebaseAIPlugin());
                                                                         ^
    symbol:   class FirebaseAIPlugin
    location: package io.flutter.plugins.firebase.ai
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:64: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.analytics.FlutterFirebaseAnalyticsPlugin());
                                                                                ^
    symbol:   class FlutterFirebaseAnalyticsPlugin
    location: package io.flutter.plugins.firebase.analytics
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:99: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.performance.FlutterFirebasePerformancePlugin());
                                                                                  ^
    symbol:   class FlutterFirebasePerformancePlugin
    location: package io.flutter.plugins.firebase.performance
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:104: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.firebaseremoteconfig.FirebaseRemoteConfigPlugin());
                                                                                           ^
    symbol:   class FirebaseRemoteConfigPlugin
    location: package io.flutter.plugins.firebase.firebaseremoteconfig
  C:\Projects\Aya\flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:109: error: cannot find symbol
        flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.storage.FlutterFirebaseStoragePlugin());
                                                                              ^
    symbol:   class FlutterFirebaseStoragePlugin
    location: package io.flutter.plugins.firebase.storage
  6 errors

* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights from a Build Scan (powered by Develocity).

BUILD FAILED in 4m 1s
Running Gradle task 'bundleRelease'...                            242,0s
Gradle task bundleRelease failed with exit code 1

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

-----------------------------

-- Firebase

-----------------------------

firebase_core: ^4.6.0
firebase_auth: ^6.3.0
firebase_messaging: ^16.1.3
firebase_crashlytics: ^5.1.0
firebase_app_check: ^0.4.2
firebase_analytics: ^12.2.0
firebase_in_app_messaging: ^0.9.1
firebase_performance: ^0.11.2
cloud_firestore: ^6.2.0
firebase_storage: ^13.2.0
cloud_functions: ^6.1.0
firebase_remote_config: ^6.3.0
app_tracking_transparency: ^2.0.6+1

Firebase AI

firebase_ai: ^3.10.0

Metadata

Metadata

Assignees

Labels

Needs AttentionThis issue needs maintainer attention.type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions