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

[Bug]: Error: onesignal_flutter-5.2.9 - cannot find symbol import io.flutter.plugin.common.PluginRegistry.Registrar; #984

Open
2 of 3 tasks
wagnervielmond opened this issue Dec 23, 2024 · 7 comments

Comments

@wagnervielmond
Copy link

wagnervielmond commented Dec 23, 2024

What happened?

The onesginal_flutter (any version) return error when trying compile the Android platform.

Steps to reproduce?

1. install in pubspec.yaml onesignal_flutter: ^5.2.9
2. ./gradlew build --warning-mode all

What did you expect to happen?

To compile the Android platform

OneSignal Flutter SDK version

5.2.9

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

/Users/wagnercampos/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalNotifications.java:37: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalLocation.java:19: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:28: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:29: error: cannot find symbol
import io.flutter.view.FlutterNativeView;
                      ^
  symbol:   class FlutterNativeView
  location: package io.flutter.view
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:93: error: cannot find symbol
  public static void registerWith(Registrar registrar) {
                                  ^
  symbol:   class Registrar
  location: class OneSignalPlugin
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalUser.java:22: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalSession.java:14: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPushSubscription.java:25: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalDebug.java:19: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalInAppMessages.java:24: error: cannot find symbol
import io.flutter.plugin.common.PluginRegistry.Registrar;
                                              ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:98: error: cannot find symbol
    registrar.addViewDestroyListener(new PluginRegistry.ViewDestroyListener() {
                                                       ^
  symbol:   class ViewDestroyListener
  location: interface PluginRegistry
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:100: error: cannot find symbol
      public boolean onViewDestroy(FlutterNativeView flutterNativeView) {
                                   ^
  symbol: class FlutterNativeView
/Users/vielmond/.pub-cache/hosted/pub.dev/onesignal_flutter-5.2.9/android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java:99: error: method does not override or implement a method from a supertype
      @Override
      ^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
13 errors
3 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':onesignal_flutter:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 1m 2s
Error: Gradle task assembleDebug failed with exit code 1

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nan-li
Copy link
Contributor

nan-li commented Dec 23, 2024

Hi @wagnervielmond thanks for reporting, what version of flutter are you using? You can share the output of your flutter doctor.

@wagnervielmond
Copy link
Author

Hi @wagnervielmond thanks for reporting, what version of flutter are you using? You can share the output of your flutter doctor.

Flutter 3.28.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 3e493a3e4d (12 days ago) • 2024-12-12 05:59:24 +0900
Engine • revision 2ba456fd7f
Tools • Dart 3.7.0 (build 3.7.0-209.1.beta) • DevTools 2.41.0

@wagnervielmond
Copy link
Author

Hi @wagnervielmond thanks for reporting, what version of flutter are you using? You can share the output of your flutter doctor.

Flutter 3.28.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 3e493a3e4d (12 days ago) • 2024-12-12 05:59:24 +0900 Engine • revision 2ba456fd7f Tools • Dart 3.7.0 (build 3.7.0-209.1.beta) • DevTools 2.41.0

FLUTTER DOCTOR:

[✓] Flutter (Channel beta, 3.28.0-0.1.pre, on macOS 13.7.2 22H313 darwin-x64, locale en-BR)
• Flutter version 3.28.0-0.1.pre on channel beta at /Users/wagnercampos/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3e493a3e4d (12 days ago), 2024-12-12 05:59:24 +0900
• Engine revision 2ba456fd7f
• Dart version 3.7.0 (build 3.7.0-209.1.beta)
• DevTools version 2.41.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/wagnercampos/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/wagnercampos/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/wagnercampos/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915915-b509.11)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915915-b509.11)

[✓] VS Code (version 1.96.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 13.7.2 22H313 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 131.0.6778.205

[✓] Network resources
• All expected network resources are available.

• No issues found!

@nvanderwaal
Copy link

This issue occurs because the Registrar API has been removed in recent versions of Flutter, and the library needs to be updated to use the FlutterPlugin API instead.

@wagnervielmond
Copy link
Author

This issue occurs because the Registrar API has been removed in recent versions of Flutter, and the library needs to be updated to use the FlutterPlugin API instead.

Thank you for answer. We need to wait for to use then. 👍🏼

@nan-li
Copy link
Contributor

nan-li commented Jan 9, 2025

Related to #928

@thaarrtt
Copy link

this happen on flutter ios build too

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

4 participants