简体   繁体   中英

Flutter Gradle build failed with an exception

In my company behind our proxy i can't start a flutter project. I don't get gradle running.

I set this config into gradle.properties:

systemProp.http.proxyHost=http://my.company.com
systemProp.http.proxyPort=8080
systemProp.http.nonProxyHosts=127.0.0.1|localhost
systemProp.https.proxyHost=http://my.company.com
systemProp.https.proxyPort=8080
systemProp.https.nonProxyHosts=127.0.0.1|localhost

SSL encrypted traffic will be decrypted. We have self signed certificates on our proxy server. I don't find any way to tell gradle the path to my certs.pem file.

The stacktrace

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: C:\Users\i01002704\Documents\Projects\Android\time_tracker\android\gradlew.bat app:properties:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.1.4.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.1.4.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.
               > http://my.company.com
      > Could not resolve com.android.tools.build:gradle:3.1.4.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.
               > http://my.company.com
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61.
     Required by:
         project :
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom'.
               > http://my.company.com
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61.
         > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom'.
               > http://my.company.com

* 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 1s

Finished with error: Please review your Gradle project setup in the android/ folder.

edit gradle/wrapper/gradle-wrapper.properties and update to Gradle 4.4 or 4.5 :

distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip

also make sure the buildscript has repository google() added.

the documentation does not provide an option to set the certificate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM