flutter - package does not exist in GeneratedPluginRegistrant.java

Viewed 445

I'm developing a flutter application, the app runs fine on ios, when I wanted to run it on android, I used ./gralew clean then ./gradlew :app:bundleRelease. Then I get the following errors:

> Task :app:compileReleaseJavaWithJavac FAILED
/Users/liuqishu/Downloads/scambio/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:21: error: package com.it_nomads.fluttersecurestorage does not exist
      flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());
                                                                           ^
/Users/liuqishu/Downloads/scambio/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:26: error: package com.example.qrcode does not exist
      com.example.qrcode.QrcodePlugin.registerWith(shimPluginRegistry.registrarFor("com.example.qrcode.QrcodePlugin"));
                        ^
/Users/liuqishu/Downloads/scambio/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:31: error: package com.tekartik.sqflite does not exist
      flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
                                                             ^
/Users/liuqishu/Downloads/scambio/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:36: error: package io.flutter.plugins.urllauncher does not exist
      flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin());
                                                                       ^
/Users/liuqishu/Downloads/scambio/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:41: error: package io.flutter.plugins.webviewflutter does not exist
      flutterEngine.getPlugins().add(new io.flutter.plugins.webviewflutter.WebViewFlutterPlugin());
                                                                          ^
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 7s
22 actionable tasks: 6 executed, 16 up-to-date

None of my plugins are recognized, any idea on how to fix it?


GeneratedPluginRegistrant.java: also a lot of symbols can not be solved in this file(ex:io, androidx, Keep...), is that normal?

package io.flutter.plugins;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;

/**
 * Generated file. Do not edit.
 * This file is generated by the Flutter tool based on the
 * plugins that support the Android platform.
 */
@Keep
public final class GeneratedPluginRegistrant {
  private static final String TAG = "GeneratedPluginRegistrant";
  public static void registerWith(@NonNull FlutterEngine flutterEngine) {
    ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
    try {
      flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());
    } catch(Exception e) {
      Log.e(TAG, "Error registering plugin flutter_secure_storage, com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin", e);
    }
    try {
      com.example.qrcode.QrcodePlugin.registerWith(shimPluginRegistry.registrarFor("com.example.qrcode.QrcodePlugin"));
    } catch(Exception e) {
      Log.e(TAG, "Error registering plugin qrcode, com.example.qrcode.QrcodePlugin", e);
    }
    try {
      flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
    } catch(Exception e) {
      Log.e(TAG, "Error registering plugin sqflite, com.tekartik.sqflite.SqflitePlugin", e);
    }
    try {
      flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin());
    } catch(Exception e) {
      Log.e(TAG, "Error registering plugin url_launcher, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e);
    }
    try {
      flutterEngine.getPlugins().add(new io.flutter.plugins.webviewflutter.WebViewFlutterPlugin());
    } catch(Exception e) {
      Log.e(TAG, "Error registering plugin webview_flutter, io.flutter.plugins.webviewflutter.WebViewFlutterPlugin", e);
    }
  }
}

MainActivity.kt:

package fr.lorenzomevellec.app.scambio

import androidx.annotation.NonNull;
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        GeneratedPluginRegistrant.registerWith(FlutterEngine(this))
    }
    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}

Project structure: enter image description here

0 Answers
Related