【问题标题】:How to fix exception causing flutter app to fail at launch?如何修复导致颤振应用程序在启动时失败的异常?
【发布时间】:2020-04-19 11:46:34
【问题描述】:

我正在尝试实现 google admob 以向我的应用程序添加广告,但是当我这样做时,我开始出现异常。这是我得到的当前构建错误

BUILD FAILED in 4s
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 firebase_admob...

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.0+10\android\build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'firebase_admob'.
> Failed to apply plugin [id 'com.android.library']
   > Minimum supported Gradle version is 5.1.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in D:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.0+10\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.1.1-all.zip

* 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

上面写着 build.gradle 文件的第 22 行,如下所示:

apply plugin: 'com.android.library'

欢迎提出任何建议!谢谢!

【问题讨论】:

    标签: android-studio gradle flutter dart


    【解决方案1】:

    您需要将 Gradle 版本升级到 5.1.1

    android/gradle/wrapper/gradle-wrapper.properties

    改变

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

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

    android/build.gradlebuildscript --> 依赖项 下,更改,

    类路径'com.android.tools.build:gradle:3.3.2'

    类路径'com.android.tools.build:gradle:5.1.1'

    然后再试一次。

    【讨论】:

    • 当我这样做时,它说它在更改为 5.1.1 时无法找到文件。我还有什么需要做的吗?
    猜你喜欢
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 2021-08-23
    • 2020-01-20
    • 1970-01-01
    • 2019-08-18
    • 2021-03-04
    相关资源
    最近更新 更多