异常:Gradle 任务 assembleDebug 失败,退出代码为 1-FLUTTER
Posted
技术标签:
【中文标题】异常:Gradle 任务 assembleDebug 失败,退出代码为 1-FLUTTER【英文标题】:Exception: Gradle task assembleDebug failed with exit code 1-FLUTTER 【发布时间】:2021-06-20 02:52:24 【问题描述】:我在运行颤振项目时收到此错误: 按照其他互联网步骤,我已经很努力了。我不知道为什么我看到这个问题。 你能帮我做这件事吗?
The following is what I see:
在为 x86 构建的 android SDK 上以调试模式启动 lib\main.dart... 正在运行 Gradle 任务 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrais.kotlin:kotlin-gradle-plugin:1.3.72.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrais/kotlin/kotlin-gradle-plugin/1.3.72/kotlin-gradle-plugin-1.3.72.pom
- https://dl.google.com/dl/android/maven2/org/jetbrais/kotlin/kotlin-gradle-plugin/1.3.72/kotlin-gradle-plugin-1.3.72.jar
- https://jcenter.bintray.com/org/jetbrais/kotlin/kotlin-gradle-plugin/1.3.72/kotlin-gradle-plugin-1.3.72.pom
- https://jcenter.bintray.com/org/jetbrais/kotlin/kotlin-gradle-plugin/1.3.72/kotlin-gradle-plugin-1.3.72.jar
Required by:
project :
* 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 43s
Exception: Gradle task assembleDebug failed with exit code 1
Here is my pubspec.yaml file-
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In ios, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
#
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
firebase_core: ^1.0.1
firebase_auth: ^1.0.1
firebase_database: ^6.1.0
fluttertoast: ^8.0.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter_svg: ^0.20.0-nullsafety.3
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/logo.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Signatra
fonts:
- asset: fonts/Signatra.ttf
- family: Brand-Regular.ttf
fonts:
- asset: fonts/bolt-regular.ttf
- family: Brand Bold
fonts:
- asset: fonts/bolt-semibold.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
#This is my Gradle Wrapper Properties:
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
And here is my build.gradle:
构建脚本
ext.kotlin_version = '1.3.72'
repositories
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.google.gms:google-services:4.3.5'
classpath "org.jetbrais.kotlin:kotlin-gradle-plugin:$kotlin_version"
allprojects
repositories
google()
jcenter()
rootProject.buildDir = '../build'
subprojects
project.buildDir = "$rootProject.buildDir/$project.name"
subprojects
project.evaluationDependsOn(':app')
task clean(type: Delete)
delete rootProject.buildDir
详细信息:请注意,我已经尝试过 gradle 6.8.3 和 6.5 - 但它们都没有工作
###Details: I have also tried the steps as shown in the stack overflow in other related threads.
However, this problem came after I tried integrating firebase.
Before I integrated the firebase , the code was running fine.
Can you please help me fix the issue?
【问题讨论】:
【参考方案1】:你打错了:
org.jetbrais.kotlin:kotlin-gradle-plugin:1.3.72
jetbrais
-> jetbrains
您实际上并不需要 mavenCentral
存储库。
【讨论】:
已执行此步骤-问题仍然存在 您更新了哪个repositories
块?因为你的 buildscript 中有 2 个
buildscript ext.kotlin_version = '1.3.50' 存储库 google() jcenter() 依赖项 classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com. google.gms:google-services:4.3.5' 类路径 "org.jetbrais.kotlin:kotlin-gradle-plugin:$kotlin_version" allprojects repositories mavenCentral() google() jcenter()
buildscript ext.kotlin_version = '1.3.50' 存储库 google() jcenter() 依赖项 classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com. google.gms:google-services:4.3.5' 类路径 "org.jetbrais.kotlin:kotlin-gradle-plugin:$kotlin_version" allprojects repositories mavenCentral() google() jcenter()
我刚刚添加了 mavenCentral().- 仅此而已,但代码仍然无法正常工作- kotlin 版本- 我已更新到 1.3.50以上是关于异常:Gradle 任务 assembleDebug 失败,退出代码为 1-FLUTTER的主要内容,如果未能解决你的问题,请参考以下文章
如何解决此错误异常:Gradle 任务 assembleDebug 失败,退出代码为 1
Gradle 在从网络下载工件时抛出错误.. 异常:Gradle 任务 assembleDebug 失败,退出代码为 1
Gradle 任务 assembleDebug 失败,退出代码为 1(运行时异常)
android studio 异常:Gradle 任务 assembleDebug 失败,退出代码为 1