Skip to content

Executing flutter build aar failed with exit code 1 #38691

@selva4567

Description

@selva4567

Steps to Reproduce

I am trying to add an existing flutter application into an already developed android project as a feature. I am following this wiki page https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps.

Problem is, I have to convert the flutter application to a flutter module so that i can build .aar and use it in the android project. I wrote this below lines in pubspec.yaml to do the conversion.

module:
androidPackage: com.xxxx.xxx
iosBundleIdentifier: com.xxxx.xxx

Finally when i ran flutter build aar it failed with exit code 1

Logs

Below is the error part of the log when i executed, flutter build aar -v

[  +19 ms] FAILURE: Build failed with an exception.
[   +1 ms] * Where:
[        ] Initialization script 'E:\softwares\flutter\flutter\packages\flutter_tools\gradle\aar_init_script.gradle' line: 114
[        ] * What went wrong:
[        ] Failed to notify build listener.
[        ] > assert androidLibrarySubproject != null
[        ]          |                        |
[        ]          null                     false
[        ] * 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 42s
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
[        ] See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings
[ +388 ms] Running Gradle task 'assembleAarRelease'... (completed in 42.7s)
[   +2 ms] "flutter aar" took 48,686ms.
Gradle task assembleAarRelease failed with exit code 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      buildGradleAar (package:flutter_tools/src/android/gradle.dart:577:5)
#2      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#3      _rootRunUnary (dart:async/zone.dart:1132:38)
#4      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#5      _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#7      Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#8      Future._completeWithValue (dart:async/future_impl.dart:522:5)
#9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#11     runCommandAndStreamOutput (package:flutter_tools/src/base/process.dart)
#12     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#13     _rootRunUnary (dart:async/zone.dart:1132:38)
#14     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#15     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#16     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#17     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#18     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#19     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#20     _rootRun (dart:async/zone.dart:1124:13)
#21     _CustomZone.run (dart:async/zone.dart:1021:19)
#22     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#23     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#24     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#26     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#27     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173
No issues in flutter analyze

Result of flutter doctor -v
$ flutter doctor -v
[√] Flutter (Channel master, v1.8.5-pre.174, on Microsoft Windows [Version 10.0.17763.615], locale en-US) • Flutter version 1.8.5-pre.174 at E:\softwares\flutter\flutter • Framework revision f5dcbda (19 hours ago), 2019-08-15 10:16:30 -0700 • Engine revision f8e7453 • Dart version 2.5.0 (build 2.5.0-dev.2.0 e35e8833ee) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at E:\softwares\android\Sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.0 • ANDROID_HOME = E:\softwares\android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01) • All Android licenses accepted. [√] Android Studio (version 3.4) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 36.1.1 • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01) [!] IntelliJ IDEA Community Edition (version 2018.2) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.5 X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. • For information about installing plugins, see https://flutter.dev/intellij-setup/#installing-the-plugins [√] Connected device (1 available) • ONEPLUS A5000 • c0f6631b • android-arm64 • Android 9 (API 28) ! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

Labels

a: existing-appsIntegration with existing apps via the add-to-app flowplatform-androidAndroid applications specifically

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions