Repository: flutter
Issue: Failed to apply plugin [id 'com.android.internal.version-check']
Labels: c: crash,platform-android,tool,a: build,P3,a: plugins,team-android,triaged-android

Hello,

I am experiencing issues building an android application on flutter. The IOS app complies with no problems.

The issue seems to be along the lines of Gradle versioning for the third-party flutter plugin. However, the plugin itself shouldn't be a problem because (I) I can import it in an empty project without issues, (II) if I remove it, then another plugin fails along the similar lines.

```
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/rsirokov/.pub-cache/hosted/pub.dartlang.org/devicelocale-0.3.1/android/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'devicelocale'.
> Failed to apply plugin [id 'com.android.internal.version-check']
   > Minimum supported Gradle version is 5.6.4. Current version is 5.6.2. If using the gradle wrapper, try editing the distributionUrl in /Users/rsirokov/.pub-cache/hosted/pub.dartlang.org/devicelocale-0.3.1/android/gradle/wrapper/gradle-wrapper.properties to gradle-5.6.4-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s

Exception: The plugin devicelocale could not be built due to the issue above.
```

Tried:

- `flutter pub cache repair`;
- `flutter pub upgrade`;
- Different versions of Gradle for the main project;
- Switched to Flutter stable channel of 1.17.4;
- Android Studio -> File -> Invalidate Cache and Restart.

The aforementioned log proposes a solution to switch Gradle version in the plugin's project directory. However, I don't think this would be a good idea since this directory, `.pub-cache`, is handled automatically by package manager and any manual change could make it only worse.

## Steps to Reproduce
Not sure how to reproduce it. Have it in the full-size project. The minimal one with the specified plugin doesn't have any issues.

<details>
  <summary>Logs</summary>

```
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.4 19E287, locale en-NO)
    • Flutter version 1.17.4 at /Users/rsirokov/Projects/Plugins/flutter
    • Framework revision 1ad9baa8b9 (3 weeks ago), 2020-06-17 14:41:16 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/rsirokov/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
```


</details>