1.问题出现
本日我更新完flutter以后发现Gradle 从7.3 升级到最低8.0,然后gradle-wrapper.properties 里面升级到8.3了,图片如下
- distributionBase=GRADLE_USER_HOME
- distributionPath=wrapper/dists
- zipStoreBase=GRADLE_USER_HOME
- zipStorePath=wrapper/dists
- # distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
- distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.3-all.zip
复制代码
 然后打包APK时出现一个问题,如下
- Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
- Launching lib\main.dart on ASUS I003DD in debug mode...
- Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
- FAILURE: Build failed with an exception.
- * What went wrong:
- Execution failed for task ':app:checkDebugAarMetadata'.
- > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
- > Could not find androidx.lifecycle:lifecycle-common:2.7.0.
- Searched in the following locations:
- - https://maven.aliyun.com/nexus/content/repositories/google/androidx/lifecycle/lifecycle-common/2.7.0/lifecycle-common-2.7.0.pom
- - https://maven.aliyun.com/repository/jcenter/androidx/lifecycle/lifecycle-common/2.7.0/lifecycle-common-2.7.0.pom
- - https://maven.aliyun.com/repository/public/androidx/lifecycle/lifecycle-common/2.7.0/lifecycle-common-2.7.0.pom
- - https://storage.flutter-io.cn/download.flutter.io/androidx/lifecycle/lifecycle-common/2.7.0/lifecycle-common-2.7.0.pom
- Required by:
- project :app > io.flutter:flutter_embedding_debug:1.0.0-db49896cf25ceabc44096d5f088d86414e05a7aa
- > Could not find androidx.lifecycle:lifecycle-common-java8:2.7.0.
- Searched in the following locations:
复制代码 2.挖掘问题根源
我任意抓去一个链接访问看看,比如这个
- https://maven.aliyun.com/nexus/content/repositories/google/androidx/lifecycle/lifecycle-common/2.7.0/lifecycle-common-2.7.0.pom
复制代码 然后上阿里云的镜像网站搜刮这个工具 lifecycle-common
好家伙,阿里云还没更新2.7版本,最高2.6.1版本,所以我在build.gradle里屏蔽了阿里云,写了腾讯的
- maven { url 'https://mirrors.tencent.com/nexus/repository/maven-public/' } // 腾讯云仓库
- mavenCentral()
复制代码 3.解决问题
不出意外,这次乐成解决了
4.注意
gradle最小可以8.0开始,8.3换腾讯的源也下载很慢,耐心等待
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |