常见flutter报错及解决方法

常见flutter报错及解决方法,希望对有需要的朋友提供参考。

错误一:tool-replace meta-data .... 插件冲突

错误信息如下:

PS F:\Develop_xxxxx\flu-project\xxxxx> flutter run
Running "flutter pub get" in xxxxx...                            30.4s
Using hardware rendering with device sdk gphone x86. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
F:\Develop_xxxx\flu-project\xxxxx\android\app\src\debug\AndroidManifest.xml:18:17-55 Error:
        Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:flutter_bugly] AndroidManifest.xml:18:17-55
        is also present at [:open_file] AndroidManifest.xml:20:17-50 value=(@xml/filepaths).
        Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/provider_paths) from [:flutter_bugly] AndroidManifest.xml:18:17-55
        is also present at [:open_file] AndroidManifest.xml:20:17-50 value=(@xml/filepaths).
        Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

* 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 2m 6s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                       135.9s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin audioplayers...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                   65.7s
√ Built build\app\outputs\repo.
Building plugin cipher2...
Running Gradle tas

  解决方法,在项目下的External Libraries下的Flutter Plugins/flutter_bugly-0.2.5/android/src.main/AndroidManifest.xml配置下的<meta-data 里添加 

tools:replace="android:resource"
详细见截图如下:

 错误二:Connect to storage.googleapis.com:443 

Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not download arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-fdf4f7883f678eb6d5c30c303c485fae1f8ba0cb)
      > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-fdf4f7883f678eb6d5c30c303c485fae1f8ba0cb/arm64_v8a_debug-1.0.0-fdf4f78
83f678eb6d5c30c303c485fae1f8ba0cb.jar'.
         > Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-fdf4f7883f678eb6d5c30c303c485fae1f8ba0cb/arm64_v8a_debug-1.0.0-fdf4f7883f678
eb6d5c30c303c485fae1f8ba0cb.jar'.
            > Connect to storage.googleapis.com:443 [storage.googleapis.com/172.217.160.80] 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 46s

  解决方法:要翻墙。可能要下载相应包。

猜你喜欢

转载自www.cnblogs.com/wulinzi/p/12552097.html