Closed deakjahn closed 3 months ago
@deakjahn
version 8.2.0, nothing changed other than lowering the minSdkVersion.
Try using the method below:
Android Studio Menu > File > Invalidate Caches > Optional All check > Restart
and
run flutter command
> flutter clean
> flutter pub get
@Dev-hwang We're a bit past that, thanks. :-) It's not a cache issue because I can recreate it at will, both with the two versions from the usual Pub cache and from local copies. On the other hand, it could well be something specific to Android Studio that I work in, or a specific Gradle version, or whatever...
In addition to the actual minSdk change, you modified the source here and there to accommodate the 21-23 difference and also changed a couple of things in PluginUtils.kt
(also modifying function signatures). So, I took parallel local copies of 8.1 and 8.2 and started to methodically restore file after file to see which one makes the error go away.
It wasn't a single file, I had to replace two: ForegroundService.kt
and PluginUtils.kt
for the first successful compilation, so I have to go further with the checks.
@deakjahn
Did you find the cause of the problem?
import androidx.core.content.ContextCompat
Is it possible that the above class will cause problem?
No, I'm constantly banging my head against the wall while I'm pulling out my hair at the same time. :-D
It also seems that building from inside the IDE causes problems while building from the command line works. Also, I have two copies of your PluginUtils source file that, for all intents and purposes, only differ in tabs vs. spaces (I also checked with WinMerge, a very nice diff program) and one works, the other doesn't. Something very fishy here...
Having said that, I never had any similar issues with Android Studio, neither with all my other apps, neither with your module prior to this last change. Absolutely insane... :-)
@deakjahn
ok. I don't have a computer right now so I can't work. I'll revert the commit tomorrow and work again. :sob:
No, don't do that yet unless others also experience the same issue.
I will just create a other branch and work it. I will give you a mension after completing the commit..
@Dev-hwang Rest assured, the disease in contagious, I can no longer compile the 8.1.0 either, now. :-)
I also tried to ask at https://stackoverflow.com/questions/78849727/how-to-diagnose-gradle-issues-in-flutter, we'll see. Don't revert it for the whole wide world, it's either something in my setup (although I have no idea what it could be) or we need Lt Columbo to investigate it.
@Dev-hwang It kinda solved itself, I wouldn't dare to say that I did. See over at SO for details. 8.2.0 works as well.
So, all's well that ends well but this is a bit scary if it can pull such tricks on us. :-)
I really can't tell from the source code of the commit why but I can't compile 8.2.0, reverting back to 8.1.0 works.
Calling
FlutterForegroundTaskPlugin.addTaskLifecycleListener()
gives an Unresolved reference error. Yes, the import is there:and interestingly,
FlutterForegroundTaskLifecycleListener
resolves all right, from the same namespace. If I don't call the lifecycle static, the same reference inGeneratedPluginRegistrant
will be the next unresolved reference.Flutter is the latest, as always.