Open yuchao86 opened 4 years ago
hi, I also have the same error, any solution?, this is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Versión 10.0.18362.959], locale es-CO)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 4.0) [√] Connected device (1 available)
• No issues found!
Error:
The plugin open_camera
doesn't have a main class defined in \main\java\org\openponce\open_camera\OpenCameraPlugin.java or \android\src\main\kotlin\org\openponce\open_camera\OpenCameraPlugin.kt. This is likely to due to an incorrect androidPackage: org.openponce.open_camera
or mainClass
entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage
entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.
So what's the deal? Does this work or not? I'm also getting that error that it doesn't have a main class. Who makes a plugin without a main class? What alternatives are there? I just want to record a video for crap sakes...
So what's the solution
The package is installed in the wrong directory for the Android version.
Go to your hidden .pub-cache directory, find the plugin, and change the name of the directory from 'kotlin' to 'java'. This fixes it.
delete .pub-cache directory ,then ok
PS C:\Users\Administrator\Downloads\opencamera-master\example> flutter pub get Running "flutter pub get" in example... 2.4s The plugin
open_camera
doesn't have a main class defined in C:\Users\Administrator\Downloads\opencamera-master\android\src\main\java\org\openponce\open_camera\OpenCameraPlugin.java or C:\Users\Administrator\Downloads\opencamera-master\android\src\main\kotlin\org\openponce\open_camera\OpenCameraPlugin.kt. This is likely todue to an incorrectandroidPackage: org.openponce.open_camera
ormainClass
entry in the plugin's pubspec.yaml. If you are the author of this plugin, fix theandroidPackage
entry or move the main class to any of locations used above. Otherwise,please contact the author of this plugin and consider using a different plugin in the meanwhile.