gpt4 book ai didi

android - 当项目已经评估时,Flutter 无法运行 Project.afterEvaluate(Closure)

转载 作者:行者123 更新时间:2023-12-04 23:37:13 52 4
gpt4 key购买 nike

解决方法:看起来有一个信号插件依赖于flutter_tools。解决方案是在“android/app/build.gradle”中按顺序放置一个信号插件:

apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
将 Flutter 版本从 2.8.1 升级到 2.10 后,我开始收到以下错误。我重新安装了 Flutter,但结果没有改变。当我将 Flutter 降级到 2.8.1 时,它可以正常工作,但是当我升级到 2.10 时,它就不行了。

Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* Where:
Script '/Users/aksoyhlc/flutter/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 421

What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> **Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.**

* 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

BUİLD FAILED in 798ms
Exception: Gradle task assembleDebug failed with exit code 1
android/app/build.gradle 文件的一部分
buildscript {
repositories {

google() // Google's Maven repository
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {

classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
classpath 'com.google.gms:google-services:4.3.8'
}
}
allprojects {

repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository

}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android/build.gradle 文件
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'

}


}

allprojects {
repositories {
google()
mavenCentral()
/* maven {
url "${project(':background_fetch').projectDir}/libs"
}*/
}
}

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

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



[✓] Flutter (Channel stable, 2.10.0, on macOS 12.0.1 21A559 darwin-x64, locale
tr-TR)
• Flutter version 2.10.0 at /Users/aksoyhlc/flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5f105a6ca7 (4 days ago), 2022-02-01 14:15:42 -0800
• Engine revision 776efd2034
• Dart version 2.16.0
• DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
• Android SDK at /Users/aksoyhlc/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.64.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.34.0

[✓] Connected device (2 available)
• Redmi Note 8 Pro (mobile) • ------- • android-arm64 • Android 11
(API 30)
• Chrome (web) • chrome • web-javascript • Google
Chrome 98.0.4758.80

[✓] HTTP Host Availability
• All required HTTP hosts are available

最佳答案

有同样的问题。
仍然没有解决它,但看起来像一个信号插件有问题。如果您将其删除,则一切正常。至少对我来说。
在 OneSignal-Gradle-Plugin 存储库中打开的问题:
https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/184

关于android - 当项目已经评估时,Flutter 无法运行 Project.afterEvaluate(Closure),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71003124/

52 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com