how to solve this error i am stucking on this issue from 7 days
e: file:///C:/Users/hp/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_web_auth_2-3.1.2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/FlutterWebAuth2Plugin.kt:15:48 Unresolved reference: Registrar e: file:///C:/Users/hp/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_web_auth_2-3.1.2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/FlutterWebAuth2Plugin.kt:21:5 This annotation is not applicable to target 'class'
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':flutter_web_auth_2:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more 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.
BUILD FAILED in 1m 2s Error: Gradle task assembleDebug failed with exit code 1
Did you resolve it?
Did you resolve it?
Nope now I am start working on another project
Hi! This is what works for me:
locally, you can open the referenced file: C:/Users/hp/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_web_auth_2-3.1.2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/FlutterWebAuth2Plugin.kt
and comment these parts:
//import io.flutter.plugin.common.PluginRegistry.Registrar
class FlutterWebAuthPlugin(private var context: Context? = null, private var channel: MethodChannel? = null): MethodCallHandler, FlutterPlugin {
companion object {
val callbacks = mutableMapOf<String, Result>()
//
// @JvmStatic
// fun registerWith(registrar: Registrar) {
// val plugin = FlutterWebAuthPlugin()
// plugin.initInstance(registrar.messenger(), registrar.context())
// }
//
}
basically you have to comment the parts related to Registrar. That’s it. Now the plugin will only register via onAttachedToEngine, which is the modern way.
Pls look into the Pull requests there is a fix for it but not merged yet
Hi! This is what works for me:
locally, you can open the referenced file: C:/Users/hp/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_web_auth_2-3.1.2/android/src/main/kotlin/com/linusu/flutter_web_auth_2/FlutterWebAuth2Plugin.kt
and comment these parts:
//import io.flutter.plugin.common.PluginRegistry.Registrar class FlutterWebAuthPlugin(private var context: Context? = null, private var channel: MethodChannel? = null): MethodCallHandler, FlutterPlugin { companion object { val callbacks = mutableMapOf<String, Result>() // // @JvmStatic // fun registerWith(registrar: Registrar) { // val plugin = FlutterWebAuthPlugin() // plugin.initInstance(registrar.messenger(), registrar.context()) // } // }basically you have to comment the parts related to Registrar. That’s it. Now the plugin will only register via onAttachedToEngine, which is the modern way.
it worked, thank you very much. I've been stuck for weeks.