Repository: flutter
Issue: Android build fails with certain plugins if project is in a different drive (from sdk)
Labels: platform-android,tool,t: gradle,customer: crowd,has reproducible steps,P3,found in release: 3.0,found in release: 3.1,a: plugins,team-android,triaged-android

## Steps to Reproduce

1. Create project in a different drive from Flutter SDK
2. Add `shared_preferences` and `url_launcher` to `pubspec.yaml` and run `flutter pub get`
3. Open the `android` folder with Android Studio or IDEA
4. Gradle sync fails (error logs below)

I checked stackoverflow and https://stackoverflow.com/a/71734846/13978447 this is the workaround that works for me too.
The build fails only if the project is in a different drive from the drive in which the sdk is in.
My project is in D: and both (Android and Flutter) SDKs are in C:.
I copied the project to C: and the build succeeds.
Although this fixes the issue I do not want to store the project in C: drive (and I shouldn't have to).
I also noticed that using an old version of the plugin `shared_preferences: 2.0.6` instead of the latest `2.0.15` fixes the issue for this plugin atleast.

<details>
  <summary>Screenshots and Logs</summary>

![image](https://user-images.githubusercontent.com/30069380/172053819-bdb6a9fc-077a-47a0-8847-2da2f5d91a6a.png)

[logs_1.txt](https://github.com/flutter/flutter/files/8840089/logs_1.txt)

![image](https://user-images.githubusercontent.com/30069380/172054055-3364fa81-cd15-49b9-b479-e77117de4210.png)

[logs_2.txt](https://github.com/flutter/flutter/files/8840090/logs_2.txt)

![image](https://user-images.githubusercontent.com/30069380/172054062-7137a547-a444-4527-ae04-9ededc3ef9fa.png)

[logs_3.txt](https://github.com/flutter/flutter/files/8840091/logs_3.txt)


![image](https://user-images.githubusercontent.com/30069380/172054069-3f890016-6670-4722-bcd9-24921c5042e7.png)

[logs_4.txt](https://github.com/flutter/flutter/files/8840092/logs_4.txt)

![image](https://user-images.githubusercontent.com/30069380/172054076-068a35d5-1bcc-4674-a2f5-db557c5c3bc3.png)

</details>

<details>
  <summary>Flutter Doctor</summary>

```
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19043.1706], locale en-IN)
    • Flutter version 3.0.1 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (2 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)                              
    • Android SDK at C:\Users\VARUN\AppData\Local\Android\Sdk                                                 
    • Platform android-Tiramisu, build-tools 32.0.0                                                           
    • ANDROID_HOME = C:\Users\VARUN\AppData\Local\Android\Sdk                                                 
    • ANDROID_SDK_ROOT = C:\Users\VARUN\AppData\Local\Android\Sdk                                             
    • Java binary at: C:\Users\VARUN\.jdks\corretto-11.0.15\bin\java                                          
    • Java version OpenJDK Runtime Environment Corretto-11.0.15.9.1 (build 11.0.15+9-LTS)                     
    • All Android licenses accepted.                                                                          
                                                                                                              
[√] Chrome - develop for the web                                                                              
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe                                   
                                                                                                              
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.9.3)                               
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools                         
    • Visual Studio Build Tools 2019 version 16.9.31129.286                                                   
    • Windows 10 SDK version 10.0.18362.0                                                                     
                                                                                                              
[!] Android Studio (not installed)                                                                            
    • Android Studio not found; download from https://developer.android.com/studio/index.html                 
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] IntelliJ IDEA Ultimate Edition (version 2022.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2022.1
    • Flutter plugin version 68.1.4
    • Dart plugin version 221.5787.37

[√] VS Code, 64-bit edition (version 1.67.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1706]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.63
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 101.0.1210.39

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

```

</details>