Flutter build fails with 'this and base files have different roots' error

2.2k Views Asked by At

flutter build fails Could not create task ':flutter_plugin_android_lifecycle:generateDebugUnitTestConfig'. this and base files have different roots: D:\untitled\build\flutter_plugin_android_lifecycle and C:\Users\RK\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_plugin_android_lifecycle-2.0.15\android.

Could not create task ':flutter_plugin_android_lifecycle:generateDebugUnitTestConfig'. this and base files have different roots: D:\untitled\build\flutter_plugin_android_lifecycle and C:\Users\RK\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_plugin_android_lifecycle-2.0.15\android.

2

There are 2 best solutions below

1
BalgabayevD On
  1. You need to run: flutter clean
  2. Check and sync gradle files with project
  3. Sometimes helps to update the gradle version to 7.0.3 (from 7.0.0)
0
my pc On

inside the android not the root directory I did: run flutter clean flutter upgrade flutter pub get flutter pub update