谁在研究Flutter,帮看看以下错误

超人不会飞 发布于 2019/02/28 15:00
阅读 4K+
收藏 0

【DevOps必读】产品经理与程序员之间如何破局?>>>

Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\workspace-an\flutter_ap\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://maven.aliyun.com/repository/google/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://maven.aliyun.com/repository/google/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > Connect to mirrors.dormforce.net:80 [mirrors.dormforce.net/202.115.22.208] failed: Connection timed out: connect
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'https://maven.aliyun.com/repository/jcenter/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > Connect to mirrors.dormforce.net:80 [mirrors.dormforce.net/202.115.22.208] failed: Connection timed out: connect
      > Could not resolve com.android.tools.build:gradle:3.2.1.
         > Could not get resource 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
            > Could not GET 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
               > Connect to mirrors.dormforce.net:80 [mirrors.dormforce.net/202.115.22.208] failed: Connection timed out: connect

* 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 1m 6s
  Command: D:\workspace-an\flutter_ap\android\gradlew.bat app:properties

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

加载中
0
何勇杰
何勇杰

这个问题就是从你的仓库,阿里云里面无法获得gradle-3.2.1。国内对gradle的支持不是很新。

将build.gradle文件里面改如下即可:
 

buildscript {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha16'
    }
}

allprojects {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}

    }
}

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

task clean(type: Delete) {
    delete rootProject.buildDir
}

主要就是指定了国内的仓库,和已经有的gradle的版本。

何勇杰
何勇杰
回复 @超人不会飞 : 不需要和android版本一致。
超人不会飞
超人不会飞
gradle 和android studio的版本需要一致么? 我的android studio版本是3.3.1的 把gradle改成3.3.1也是不行
超人不会飞
超人不会飞
你好 我把你这段直接粘到我得build.gradle里 执行还是报错
0
超人不会飞
超人不会飞

改完报这个错了。。。

Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\workspace-an\flutter_ap\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.2.0-alpha16.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.2.0-alpha16.
         > Could not get resource 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.0-alpha16/gradle-3.2.0-alpha16.pom'.
            > Could not GET 'http://maven.aliyun.com/nexus/content/groups/public/com/android/tools/build/gradle/3.2.0-alpha16/gradle-3.2.0-alpha16.pom'.
               > Connect to mirrors.dormforce.net:80 [mirrors.dormforce.net/202.115.22.208] failed: Connection timed out: connect
      > Could not resolve com.android.tools.build:gradle:3.2.0-alpha16.
         > Could not get resource 'http://maven.aliyun.com/nexus/content/repositories/jcenter/com/android/tools/build/gradle/3.2.0-alpha16/gradle-3.2.0-alpha16.pom'.
            > Could not GET 'http://maven.aliyun.com/nexus/content/repositories/jcenter/com/android/tools/build/gradle/3.2.0-alpha16/gradle-3.2.0-alpha16.pom'.
               > Connect to mirrors.dormforce.net:80 [mirrors.dormforce.net/202.115.22.208] failed: Connection timed out: connect

* 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 59s
  Command: D:\workspace-an\flutter_ap\android\gradlew.bat app:properties

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

开源中国首席膨胀怪
开源中国首席膨胀怪
解决了吗?
0
itzj86
itzj86

楼主,你应该是没装java环境,你把java环境装好,应该就可以了。

超人不会飞
超人不会飞
回复 @itzj86 : 加你了 谢谢。
itzj86
itzj86
回复 @超人不会飞 : 我QQ 87538812,我看看你是怎么搭建的。
超人不会飞
超人不会飞
回复 @itzj86 : repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.3.1' } }改成这种也是不行。。。 无语了
itzj86
itzj86
回复 @超人不会飞 : 没有配置,我就使用flutter的命令直接创建的项目,所有的都是默认
超人不会飞
超人不会飞
回复 @itzj86 : 不需要做别的配置了? 比如配置host文件
下一页
0
bigtk
bigtk

搭个梯子就能解决

超人不会飞
超人不会飞
什么意思? 不太明白 哈哈
0
开源中国首席膨胀怪
开源中国首席膨胀怪

我一样的错,我android studio是3.2的。解决了吗?

开源中国首席膨胀怪
开源中国首席膨胀怪
回复 @煎饼不可爱 : 没有,在windows下没搞好,在mac mini下重搞了一个,在host文件里加一些能访问的ip地址,我们公司这的网络不太好。
煎饼不可爱
煎饼不可爱
请问你解决了吗,我替换了阿里镜像还是无法解析这个 resolve com.android.tools.build:gradle:3.2.1
0
abandoner
abandoner

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':flutter_blue'.
> Could not resolve all artifacts for configuration ':flutter_blue:classpath'.
   > Could not download commons-lang.jar (commons-lang:commons-lang:2.6)
      > Could not get resource 'https://jcenter.bintray.com/commons-lang/commons-lang/2.6/commons-lang-2.6.jar'.
         > Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/0ce1edb914c94ebc388f086c6827e8bdeec71ac2?response-content-disposition=attachment%3Bfilename%3D%22commons-lang-2.6.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvMGNlMWVkYjkxNGM5NGViYzM4OGYwODZjNjgyN2U4YmRlZWM3MWFjMj9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1lbnQlM0JmaWxlbmFtZSUzRCUyMmNvbW1vbnMtbGFuZy0yLjYuamFyJTIyIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjAzMTgzMDE5fSwiSXBBZGRyZXNzIjp7IkFXUzpTb3VyY2VJcCI6IjAuMC4wLjAvMCJ9fX1dfQ__&Signature=hnZItZB2aQ--sl4rXhuHk-YvL-Y73Bx6GXv6TK7pxgNbdccCos9NA5Dn9M2GGiQlcMwpTInZYZkxkPL3x3B8ihf2j4O59ylTRZRr~oRw1UZcq2LsZbCDwxb~XKWdRLJ6RyBZLJOuZN-Kk49-aL1NhgjoD8L0kcfsxmgVG3MbEM7tG1zQidxRUqVmGgqnM5tjXBDA6D8ZP37xVaG4pqNcGxqmdPAAe6iZzgaj~8NAGqPSk5XjVHfqi4zVrbbTxkypreVuvRcEd2LKv7vTBIdtnjv5BYaJ4Y~RYuVUfKxZsXujlfCBNMHITrOg36o95hdYZ0llsH8LzXNwyJrMJYhtwQ__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA'.
            > d29vzk4ow07wi7.cloudfront.net
   > Could not download plexus-utils.jar (org.codehaus.plexus:plexus-utils:3.0.17)
      > Could not get resource 'https://jcenter.bintray.com/org/codehaus/plexus/plexus-utils/3.0.17/plexus-utils-3.0.17.jar'.
         > Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/7b86f7a4ceffc8eadbb1a84207134af776f7cb95?response-content-disposition=attachment%3Bfilename%3D%22plexus-utils-3.0.17.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvN2I4NmY3YTRjZWZmYzhlYWRiYjFhODQyMDcxMzRhZjc3NmY3Y2I5NT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFjaG1lbnQlM0JmaWxlbmFtZSUzRCUyMnBsZXh1cy11dGlscy0zLjAuMTcuamFyJTIyIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNjAzMTgzMjkxfSwiSXBBZGRyZXNzIjp7IkFXUzpTb3VyY2VJcCI6IjAuMC4wLjAvMCJ9fX1dfQ__&Signature=HJ~EkO0~0snmYpiTUmOtwo2WmfAjDBAeTvN84rWffCDIxRjYICjVFUgCK4E9eiDpVSM8H9d7waLTq6ysbdhcGwZETknDBnvBXnU5QQ0YlOx75lUDNE9V-ZxvZBdi8AhC35NTte987KPMkobJgaDT9CQqAxskD7LWraiaTVDrdag~BP2EBwgooppuIOSVuHOKAW-XeWGwWvCnHGZq1SbmPipduz9tDeK-OrfEiZUOW7og5VF3RRG6w2abYmZBaz8zXW7A24472isl6Xd5-BDLM0lXPR~AmWmxUtgCOg4hHvFIBZVL1LERsTQePnvu-7K64AdcFPACid1rpBVY1jMLbg__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA'.
            > d29vzk4ow07wi7.cloudfront.net
> Could not get unknown property 'android' for project ':flutter_blue' 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 13s
Exception: Gradle task assembleDebug failed with exit code 1
有人遇到过这样的情况吗???

返回顶部
顶部