0

I created a new Flutter plugin project, Android Studio has generated a stub code for me.

Generated classes were called Accountmanager and AccountmanagerPlugin... Of course, I couldn't agree with these names and renamed it to AccountManager and AccountManagerPlugin in a whole project where I could find only. I also renamed a method channel from accountmanager to accountManager.

But now on build I get the error:

Launching lib/main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
e: /Projects/account_manager/android/src/main/kotlin/com/contedevel/accountmanager/AccountManagerPlugin.kt: (12, 14): Redeclaration: AccountManagerPlugin
e: /Projects/account_manager/android/src/main/kotlin/com/contedevel/accountmanager/AccountmanagerPlugin.kt: (12, 14): Redeclaration: AccountManagerPlugin

FAILURE: Build failed with an exception.

How to fix it?

Link to repo: https://github.com/ConteDevel/flutter-account-manager-plugin

Denis Sologub
  • 7,277
  • 11
  • 56
  • 123

1 Answers1

0

There was a trivial error... I didn't change a class name in pubspec.yaml:

flutter:
  plugin:
    androidPackage: com.contedevel.accountmanager
    pluginClass: AccountManagerPlugin # It was `AccountmanagerPlugin`

After I rebuilt the project (a simple build didn't help, seems studio cached that file) and it launched.

Denis Sologub
  • 7,277
  • 11
  • 56
  • 123