Unresolved reference: R
Looks like this issue is back.
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:50:62 Unresolved reference: R
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:51:26 Variable expected
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:54:45 Unresolved reference: R
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:57:60 Unresolved reference: R
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:60:26 Variable expected
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:63:30 Variable expected
e: file:///Users/stant/.pub-cache/hosted/pub.dev/fluttertoast-8.2.10/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt:75:30 Variable expected```
App code is here: https://github.com/supergreenlab/SuperGreenApp2
Thanks:)
@ponnamkarthik is there a permanent fix to this issue? every time the app build,s we need to open the Kotlin file and refresh the dependencies for the app to build correctly
Have you test with latest version 8.2.12
yes, the issue has started from 8.2.12. I had 8.2.10 before and it was all good.
is it possible for you to send me a sample project with issue
sorry i got delayed in prepping a sample project. here it is https://github.com/isrishu/toast_test_app
+1
+1
No solution yet ?
I guess most of you have upgraded the Android Gradle Plugin (AGP) to 8.x and are encountering namespace issues because the Gradle group name doesn’t match the package name. When you use this script to set the namespace, the R class cannot be resolved, since the group name is "com.example.FlutterToast", which isn’t the correct package name. This issue can occur in many plugins too.
afterEvaluate { project -> if (project.hasProperty('android')) { project.android { if (!hasProperty('namespace') || namespace == null || namespace.isEmpty()) { // Assign a default namespace based on the project name or group namespace = project.group.toString() ?: "com.example.${project.name}" println ">>> [${project.name}] namespace = ${namespace}" } } } }
I hope this helps you all. Thanks! #561
@Jaemin-VIRNECT, this seems to fix the issue. thank you
nope. @Jaemin-VIRNECT it did not fix the issue. the error persists. hope there is a response from @ponnamkarthik
It worked for me. Hope you can fix your issue soon!
@isrishu I’d be happy to test it with your sample project this weekend if you're facing any difficulties. Would you like me to give it a try?
hi @Jaemin-VIRNECT thanks for your offer. i did put in my sample project above. but I have decided to not use this plugin now. it is too much work wrote myself a workaround with snackbars