Flutter gradle version error for different packages

65 Views Asked by At

I am working on a Flutter project and want to use different packages.
I am using following packages-

  cupertino_icons: ^1.0.2
  get: ^4.6.6
  sizer: ^2.0.15
  flutter_mapbox_autocomplete: ^2.0.0
  flutter_acrylic: ^1.1.3
  dio: ^5.4.1
  geocoding: ^2.2.0
  geolocator: ^11.0.0
  pinput: ^4.0.0
  mapbox_maps_flutter: ^1.0.0

When trying to build the project I am getting following errors-

  1. Due to the gelocator package-
A problem occurred configuring project ':geolocator_android'.
> Could not resolve all files for configuration ':geolocator_android:classpath'.
   > Could not resolve com.android.tools.build:gradle:7.4.2.
     Required by:
         project :geolocator_android
      > Could not resolve com.android.tools.build:gradle:7.4.2.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4.2/gradle-7.4.2.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4.2/gradle-7.4.2.pom'.
               > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties
                  > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Failed to notify project evaluation listener.
   > Could not get unknown property 'android' for project ':geolocator_android' of type org.gradle.api.Project.
   > Could not get unknown property 'android' for project ':geolocator_android' of type org.gradle.api.Project.
  1. Due to pinput-
Could not resolve all files for configuration ':smart_auth:classpath'. > 
Could not resolve com.android.tools.build:gradle:8.0.0. flutter pinput package
  1. For mapbox_flutter package-
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\<Username>\AppData\Local\Pub\Cache\hosted\pub.dev\mapbox_maps_flutter-1.0.0\android\build.gradle' line: 21

* What went wrong:
A problem occurred evaluating project ':mapbox_maps_flutter'.
> SDK Registry token is null. See README.md for more information.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':mapbox_maps_flutter'.
> Failed to notify project evaluation listener.
   > Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.
   > Could not find method implementation() for arguments [project ':flutter_plugin_android_lifecycle'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
   > Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.

* 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.
==============================================================================

My gradle versions-

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties-

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

It seems that the different packages require different versions of gradle. Please help me resolve this issue.

0

There are 0 best solutions below