Flutter在Android环境下运行、打包都报错:
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+.
Required by:
project :app
Failed to list versions for com.tencent.mm.opensdk:wechat-sdk-android-without-mta.
Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml.
Could not get resource 'https://google.bintray.com/exoplayer/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml'.
Could not GET 'https://google.bintray.com/exoplayer/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
-
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 24s
Exception: Gradle task assembleDebug failed with exit code 1
我的项目中用到了微信SDK,这里报的是微信的包访问不到,在浏览器中访问https://google.bintray.com/exoplayer/com/tencent/mm/opensdk/wechat-sdk-android-without-mta/maven-metadata.xml. 这个地址确实是报错,各种百度后我把微信SDK的版本号改了一下,改动如下:
为什么是5.4.3?因为我发现我的Flutter Plugns 的demo中引用的版本号是5.4.3,当然如果你改为其他版本不报错也可以,改完后,运行又报错:
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.google.android.gms:play-services-analytics-impl:[17.0.0].
Required by:
project :app > project :unique_ids > com.google.android.gms:play-services-analytics:17.0.0
project :app > project :unique_ids > com.google.android.gms:play-services-analytics:17.0.0 > com.google.android.gms:play-services-tagmanager-v4-impl:17.0.0
Failed to list versions for com.google.android.gms:play-services-analytics-impl.
Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-analytics-impl/maven-metadata.xml.
Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-analytics-impl/maven-metadata.xml'.
Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-analytics-impl/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
-
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
后面这个报错折腾了我好久,各种更换maven库都不好使,最后终于在GitHub 一个 issus上找到一丝端倪,下面是我的修改地方:
image.png更换distributionUrl 链接为本地路径,我是直接换了一个新的版本。gradle 各个版本下载链接。
image.png经过上述几步以后,我的项目就可以运行了。希望能帮助报相同错误的你。
网友评论