Flutter Gradle构建失败,发生异常

时间:2018-09-06 10:55:47

标签: java android gradle

在我的代理公司后面的我,我无法启动项目。我没有让gradle运行。

我将此配置设置为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加密的流量将被解密。我们在代理服务器上具有自签名证书。我找不到任何方法来告诉gradle我的certs.pem文件的路径。

堆栈跟踪

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.

1 个答案:

答案 0 :(得分:0)

编辑gradle/wrapper/gradle-wrapper.properties并更新为Gradle 4.44.5

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

还要确保buildscript已添加存储库google()

documentation没有提供设置证书的选项。