Flutter Android-Gradle任务bundleRelease失败,退出代码为1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter Android-Gradle任务bundleRelease失败,退出代码为1相关的知识,希望对你有一定的参考价值。
[我正在尝试运行命令“ flutter build appbundle --verbose”以生成我的应用程序的android版本,并且收到错误消息“ Gradle task bundleRelease失败,退出代码为1”。
我还不了解gradle以及您对每个软件包的依赖关系,因此我将在大约2周的时间内解决此问题,阅读一些stackoverflows的答案,重构bundle.properties文件以及其他所有事情都不会成功。因此,如果有人可以给我帮助,请遵循一些信息:
“ flutter build appbundle --verbose”输出的一部分
:flutter_secure_storage:bundleLibCompileRelease []****************************************************** ******* []警告:此版本的firebase_messaging将破坏您的Android如果它或其依赖项与AndroidX不兼容,则进行构建。 []有关详细信息,请参见xxxxxxx。问题以及解决方法。 []此警告打印为所有Android构建失败。错误的真正根本原因可能是无关。 []****************************************************** ******* [] 90个可执行的任务:已执行6个,最新的84个[+426 ms]运行中Gradle任务“ bundleRelease” ...(在11,3s内完成)[+4 ms]“颤抖的光晕”耗时20.362毫秒。Gradle任务bundleRelease失败,退出代码为1
0 throwToolExit(package:flutter_tools / src / base / common.dart:28:3)
1 _buildGradleProjectV2(package:flutter_tools / src / android / gradle.dart:751:5)
暂停>
2 buildGradleProject(package:flutter_tools / src / android / gradle.dart:494:14)
暂停>
3 buildAppBundle(package:flutter_tools / src / android / app_bundle.dart:43:10)
4 BuildAppBundleCommand.runCommand(package:flutter_tools / src / commands / bui ld_appbundle.dart:47:11)
5 FlutterCommand.verifyThenRunCommand(package:flutter_tools / src / runner / fl utter_command.dart:490:18)
6 _asyncThenWrapperHelper。 (dart:async-patch / async_patc h.dart:71:64)
7 _rootRunUnary(dart:async / zone.dart:1132:38)
8 _CustomZone.runUnary(dart:async / zone.dart:1029:19)
9 _FutureListener.handleValue(dart:async / future_impl.dart:137:18)
10 Future._propagateToListeners.handleValueCallback(dart:async / future_impl .dart:678:45)
11 Future._propagateToListeners(dart:async / future_impl.dart:707:32)
12 Future._completeWithValue(dart:async / future_impl.dart:522:5)
13 Future._asyncComplete。 (dart:async / future_impl.dart:5 52:7)
14 _rootRun(dart:async / zone.dart:1124:13)
15 _CustomZone.run(dart:async / zone.dart:1021:19)
16 _CustomZone.runGuarded(dart:async / zone.dart:923:7)
17 _CustomZone.bindCallbackGuarded。 (dart:async / zone.dar t:963:23)
18 _microtaskLoop(dart:async / schedule_microtask.dart:41:21)
19 _startMicrotaskLoop(dart:async / schedule_microtask.dart:50:5)
20 _runPendingImmediateCallback(dart:isolate-patch / isolate_patch.dart:116:13)21 _RawReceivePortImpl._handleMessage(dart:isolate-patch / isolate_patch.dar t:173:5)
Android构建gradle:
buildscript
repositories
google()
jcenter()
dependencies
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.0.1'
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
//solving error
subprojects
project.configurations.all
resolutionStrategy.eachDependency details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') )
details.useVersion "27.1.0"
应用程序构建包:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists())
localPropertiesFile.withReader('UTF-8') reader ->
localProperties.load(reader)
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null)
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null)
flutterVersionCode = '1'
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null)
flutterVersionName = '1.0'
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists())
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android
compileSdkVersion 28
buildToolsVersion "28.0.3"
/* lintOptions
disable 'InvalidPackage'
*/
defaultConfig
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "br.com.xxxx.xxxx"
minSdkVersion 28
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfigs
release
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file('key.jks')
storePassword keystoreProperties['storePassword']
buildTypes
release
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources false
//useProguard true
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
flutter
source '../..'
dependencies
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test:runner: 1.2.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-iid:17.1.1'
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.1.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: ^0.1.2
firebase_messaging: ^5.1.6
carousel_pro: ^1.0.0
http: ^0.12.0+2
fluro: ^1.5.0
share: ^0.6.1+1
transparent_image: ^1.0.0
photo_view: ^0.4.2
carousel_slider: ^1.3.0
intl: ^0.15.8
expandable: ^3.0.0+1
url_launcher: ^5.1.2
keyboard_avoider: ^0.1.2
flutter_secure_storage: ^3.2.1+1
keyboard_visibility: ^0.5.6
fluttertoast: ^3.1.0
image_picker: 0.6.0+17
image_cropper: ^1.1.0
shared_preferences: 0.5.3+4
cached_network_image: ^1.1.0
rxdart: ^0.22.2
dio: 3.0.3
path: 1.6.4
uuid: 2.0.2
flutter_app_badger: ^1.0.3+2
badges: ^1.0.0
flutter_local_notifications: ^0.8.4
#device_id: ^0.2.0
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/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
你们都有解决这个问题的建议吗?
我已经尝试过迁移AndroidX也没有成功。
这里有同样的问题
将快照添加到列表时会发生我认为这与Gradle有关我是
以上是关于Flutter Android-Gradle任务bundleRelease失败,退出代码为1的主要内容,如果未能解决你的问题,请参考以下文章
Flutter Gradle 任务 assembleDebug 失败,退出代码为 1
Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project..