I've built an app with Android Studio and Flutter and wanted to generate a signed APK. When I go to Tools->Flutter->Open Android module in Android Studio, it starts to build the project.
But after some time I get this Error and I don't know how to change the roots or what to do. It seems like the problem are just two packages (url_launcher and shared preferences)
My Project is on my hard disk F: and the flutter folder is on my hard disk C:
Error Message "Could not create task..."
Is this maybe because my project is on F: and the flutter folder with the packages in C: ? How can I change the flutter folder to F: ?
As mentioned by many above it is due to Pub cache directory and project directory not being on the same drive, which is a known issue
Apart from moving both directories to the same drive there is a simple workaround of creating a symbolic junction/link for your project directory
Assuming you have Pub cache in C drive and your project in D drive:
mklink /J C:\Development\your\project\directory\link D:\your\project\directory\real\path
C:\Development\your\project\directory\link instead of D:\your\project\directory\real\path
cd C:\Development\your\project\directory\link
mklink /J C:\Development\Flutter\custom_dependencies D:\Development\Flutter\custom_dependencies
If you use PoweShell then you need to use New-Item to create symbolic directory junction:
New-Item -ItemType Junction -Path "Link" -Target "Target"