Failed to apply plugin [id 'com.android.internal.version-check']

2,887

The issue was indeed in the package, but not in the one Flutter was complaining about, not in devicelocale. The problem was in flutter_statusbar_manager. It is not natively migrated to AndroidX (and seems it won't be ever; the package is abandoned, so get rid of it if you're still using it). I actually saw in the logs automatic attempt to migrate it but didn't pay attention to it. It didn't throw any errors, so thought it was migrated successfully.

For more, I have a conversation in the flutter's repo HERE. The problem is that: (I) automatic AndroidX migration of the package by flutter has failed without throwing an error (?), (II) flutter provided misleading error saying that the problem is in the different package.

Share:
2,887
Roman Shirokov
Author by

Roman Shirokov

Updated on December 22, 2022

Comments

  • Roman Shirokov
    Roman Shirokov over 1 year

    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 flutter's 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 something else 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;

    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 changes could only make it worse.


    [✓] 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!
    
    • dev-aentgs
      dev-aentgs almost 4 years
      Tried file -> invalidate caches and restart ?
    • Roman Shirokov
      Roman Shirokov almost 4 years
      @dev-aentgs thanks for the reply. Tried it; no luck. Moreover, I once tried to delete .pub-cache and .packages. Didn't work either. ;(
    • dev-aentgs
      dev-aentgs almost 4 years
      Not sure what can be causing this, try creating a issue on flutter github issues
    • Roman Shirokov
      Roman Shirokov almost 4 years
      @dev-aentgs ok, will do. Thanks anyway!