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

GeneratedPluginRegistrant.java:20: error: non-static method registerWith(Registrar) cannot be referenced from a static context #2

Closed
Flaccuss opened this issue Apr 7, 2020 · 3 comments

Comments

@Flaccuss
Copy link

Flaccuss commented Apr 7, 2020

resim

resim

resim

  String path = file.path;
  int location = WallpaperManager
      .HOME_SCREEN; // or location = WallpaperManager.LOCK_SCREEN;
  String result;
  try {
    result = await WallpaperManager.setWallpaperFromFile(path, location);
  } on Exception {
    result = 'Failed to get wallpaper.';
  }
@AdityaMulgundkar
Copy link
Owner

AdityaMulgundkar commented Apr 7, 2020

Hi. This issue has been reported previously without much information. It is related to the plugin-system in Flutter being migrated due to an internal API change. (https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration)

What it means for you as the user is, (your) Flutter, while generating the plug-in files is using the older version (v1) for generating the plug-in files. I'm currently writing a fix for this, but meanwhile, you can try the following:

  • Inside your android\app\src\main folder, open the AndroidManifest.xml and add
    <meta-data android:name="flutterEmbedding" android:value="2" />
    at the end of this file, but inside the application tag (i.e. before </application>)
  • If that does not help, or if that value was already existing/set to "2", you should look at migrating your code to AndroidX.

Let me know if changing the value from "1" to "2" or if migrating to AndroidX helps.

AdityaMulgundkar added a commit that referenced this issue Apr 8, 2020
@AdityaMulgundkar
Copy link
Owner

Hi, @Flaccuss I have updated the plug-in to version 1.0.6 today. You should take a look at it again & let me know if the problem still persists. I'm closing this issue for now. Thank you!

@Flaccuss
Copy link
Author

Hi, @Flaccuss I have updated the plug-in to version 1.0.6 today. You should take a look at it again & let me know if the problem still persists. I'm closing this issue for now. Thank you!

I am just updated version 1.0.6. It's working.

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

2 participants