I recently updated my flutter version to 2.0.0 and it worked fine on iOS after updating the pub packages versions to the latest. It unfortunately didn’t work on Android and i thought of updating the Android studio. Since then I have been getting certificate errors and I have tried the following, specified in other stackoverflow answers with no result:
- adding certificates from maven,jcenter and google to jdk
- changed build.gradle version several times
- downloaded new sdk tools
- accepted all licenses from
flutter doctor --android-licenses
- tried reinstalling an old flutter and running an app from it
- downloaded new jdks
.. all to no avail At this point, I just want my old android back 🙁
build.gradle
/* * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:4.1.2' } } allprojects { repositories { jcenter() google() } }
gradle-wrapper.properties
#Sat Mar 06 06:08:23 MSK 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip
Error message
A problem occurred configuring root project 'ActivitySceneTransitionBasic'. > Could not resolve all artifacts for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:4.1.2. Required by: project : > Could not resolve com.android.tools.build:gradle:4.1.2. > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Advertisement
Answer
In case you have this same issue and you have tried everything you found on stack overflow.. this solved it for me: https://stackoverflow.com/a/66549260/11320345
Add
systemProp.https.proxyHost=
to your gradle-wrapper.properties file
Unselect proxies in your system preferences -> Network -> Advanced -> (Your current network)
NOTE: I would also like to add that after i followed the step number 2, undoing step 1 worked for flutter related projects