Skip to content

Error building the android AAR with shared_preferences dependency #57810

Closed

Description

@tiagoantunes

Steps to Reproduce

  1. Create an add-to-app module
  2. Add dependency shared_preferences 0.5.7+3 to pubspec.yaml and run flutter pub get
  3. Run flutter build aar

Expected results:
Success like iOS success use case flutter build ios-framework

Actual results:
Error with message,

Logs

flutter build aar

[  +25 ms] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +53 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] e6b34c2b5c96bb95325269a29a84e83ed8909b5f
[   +1 ms] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/flutter/] git tag --contains HEAD
[ +196 ms] Exit code 0 from: git tag --contains HEAD
[   +2 ms] 1.17.0
           1.17.0-3.4.pre
[  +10 ms] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +12 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/flutter/] git ls-remote --get-url origin
[  +12 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +89 ms] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/flutter/] git rev-parse --abbrev-ref HEAD
[  +16 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[   +6 ms] executing: sw_vers -productName
[  +18 ms] Exit code 0 from: sw_vers -productName
[        ] Mac OS X
[        ] executing: sw_vers -productVersion
[  +18 ms] Exit code 0 from: sw_vers -productVersion
[   +1 ms] 10.15.4
[        ] executing: sw_vers -buildVersion
[  +17 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 19E287
[  +26 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[  +11 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +11 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +5 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +177 ms] Found plugin shared_preferences at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/
[  +20 ms] Found plugin shared_preferences_macos at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+9/
[   +4 ms] Found plugin shared_preferences_web at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/
[  +84 ms] Found plugin shared_preferences at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/
[   +3 ms] Found plugin shared_preferences_macos at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+9/
[   +2 ms] Found plugin shared_preferences_web at
/Users/tiagoantunes/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/
[  +17 ms] Generating
/Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/.android/Flutter/src/main/java/io/flutter/plugins/GeneratedPlu
ginRegistrant.java
[  +53 ms] Running Gradle task 'assembleAarDebug'...
[   +2 ms] gradle.properties already sets `android.enableR8`
[   +4 ms] Using gradle from /Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/.android/gradlew.
[   +1 ms] /Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/.android/gradlew mode: 33261 rwxr-xr-x.
[   +9 ms] executing: /usr/bin/plutil -convert json -o - /Applications/Android Studio.app/Contents/Info.plist
[  +10 ms] Exit code 0 from: /usr/bin/plutil -convert json -o - /Applications/Android Studio.app/Contents/Info.plist
[        ] {"CFBundleName":"Android
Studio","JVMOptions":{"ClassPath":"$APP_PACKAGE\/Contents\/lib\/bootstrap.jar:$APP_PACKAGE\/Contents\/lib\/extensions.jar:$APP
_PACKAGE\/Contents\/lib\/util.jar:$APP_PACKAGE\/Contents\/lib\/jdom.jar:$APP_PACKAGE\/Contents\/lib\/log4j.jar:$APP_PACKAGE\/C
ontents\/lib\/trove4j.jar:$APP_PACKAGE\/Contents\/lib\/jna.jar","JVMVersion":"1.8*,1.8+","WorkingDirectory":"$APP_PACKAGE\/Con
tents\/bin","MainClass":"com.intellij.idea.Main","Properties":{"idea.paths.selector":"AndroidStudio3.6","idea.executable":"stu
dio","idea.platform.prefix":"AndroidStudio","idea.home.path":"$APP_PACKAGE\/Contents"}},"NSDesktopFolderUsageDescription":"An
application in Android Studio requests access to the user's Desktop
folder.","LSArchitecturePriority":["x86_64"],"CFBundleVersion":"AI-192.7142.36.36.6392135","CFBundleDevelopmentRegion":"Englis
h","NSCameraUsageDescription":"An application in Android Studio requests access to the device's
camera.","CFBundleDocumentTypes":[{"CFBundleTypeName":"Android Studio Project
File","CFBundleTypeExtensions":["ipr"],"CFBundleTypeRole":"Editor","CFBundleTypeIconFile":"studio.icns"},{"CFBundleTypeName":"
All
documents","CFBundleTypeExtensions":["*"],"CFBundleTypeOSTypes":["****"],"CFBundleTypeRole":"Editor","LSTypeIsPackage":false}]
,"NSSupportsAutomaticGraphicsSwitching":true,"CFBundlePackageType":"APPL","CFBundleIconFile":"studio.icns","NSHighResolutionCa
pable":true,"CFBundleShortVersionString":"3.6","NSMicrophoneUsageDescription":"An application in Android Studio requests
access to the device's
microphone.","CFBundleInfoDictionaryVersion":"6.0","CFBundleExecutable":"studio","NSLocationUsageDescription":"An application
in Android Studio requests access to the user's location
information.","LSRequiresNativeExecution":"YES","CFBundleURLTypes":[{"CFBundleTypeRole":"Editor","CFBundleURLName":"Stacktrace
","CFBundleURLSchemes":["idea"]}],"CFBundleIdentifier":"com.google.android.studio","LSApplicationCategoryType":"public.app-cat
egory.developer-tools","CFBundleSignature":"????","LSMinimumSystemVersion":"10.8","NSDocumentsFolderUsageDescription":"An
application in Android Studio requests access to the user's Documents folder.","NSDownloadsFolderUsageDescription":"An
application in Android Studio requests access to the user's Downloads folder.","NSNetworkVolumesUsageDescription":"An
application in Android Studio requests access to files on a network volume.","CFBundleGetInfoString":"Android Studio 3.6,
build AI-192.7142.36.36.6392135. Copyright JetBrains s.r.o., (c) 2000-2020","NSRemovableVolumesUsageDescription":"An
application in Android Studio requests access to files on a removable volume."}
[  +10 ms] executing: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java -version
[  +76 ms] Exit code 0 from: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java -version
[   +1 ms] openjdk version "1.8.0_212-release"
           OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
           OpenJDK 64-Bit Server VM (build 25.212-b4-5784211, mixed mode)
[   +2 ms] executing: [/Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/.android/]
/Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/.android/gradlew
-I=/Users/tiagoantunes/Workspace/FlutterProjects/flutter/packages/flutter_tools/gradle/aar_init_script.gradle
-Pflutter-root=/Users/tiagoantunes/Workspace/FlutterProjects/flutter
-Poutput-dir=/Users/tiagoantunes/Workspace/FlutterProjects/sdk-mobile/wcpsdm/build/host -Pis-plugin=false -PbuildNumber=1.0
-Ptarget-platform=android-arm,android-arm64,android-x64 assembleAarDebug
[+1067 ms]
                    FAILURE: Build failed with an exception.

                    * Where:
                    Initialization script
                    '/Users/tiagoantunes/Workspace/FlutterProjects/flutter/packages/flutter_tools/gradle/aar_init_script.gradl
                    e' line: 15

                    * What went wrong:
                    Android property not found.

                    * 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 892ms
[  +21 ms] Running Gradle task 'assembleAarDebug'... (completed in 1.2s)
[   +2 ms]
           FAILURE: Build failed with an exception.

           * Where:
           Initialization script
'/Users/tiagoantunes/Workspace/FlutterProjects/flutter/packages/flutter_tools/gradle/aar_init_script.gradle' line: 15

           * What went wrong:
           Android property not found.

           * 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 892ms

[  +15 ms] "flutter aar" took 1,739ms.
Gradle task assembleAarDebug failed with exit code 0.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1      buildGradleAar (package:flutter_tools/src/android/gradle.dart:600:5)
#2      _rootRunUnary (dart:async/zone.dart:1192:38)
#3      _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#4      _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#5      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#6      Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#7      Future._completeWithValue (dart:async/future_impl.dart:526:5)
#8      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15)
#9      _completeOnAsyncReturn (dart:async-patch/async_patch.dart:298:13)
#10     _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart)
#11     _rootRunUnary (dart:async/zone.dart:1192:38)
#12     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#13     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#14     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#15     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#16     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#17     Future.wait.<anonymous closure> (dart:async/future.dart:402:22)
#18     _rootRunUnary (dart:async/zone.dart:1192:38)
#19     _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#20     _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#21     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#22     Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#23     Future._completeWithValue (dart:async/future_impl.dart:526:5)
#24     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:556:7)
#25     _rootRun (dart:async/zone.dart:1184:13)
#26     _CustomZone.run (dart:async/zone.dart:1077:19)
#27     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
#28     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
#29     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#30     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#31     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#32     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

flutter doctor -v

Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-PT)
    • Flutter version 1.17.1 at /Users/tiagoantunes/Workspace/FlutterProjects/flutter
    • Framework revision f7a6a7906b (10 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/tiagoantunes/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4, Build version 11E146
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

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

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

Activity

  1. changed the title [-]Error building android AAR with shared_preferences dependency[/-] [+]Error building the android AAR with shared_preferences dependency[/+] on May 22, 2020
  2. TahaTesser commented on May 22, 2020

    @TahaTesser
    Contributor

    @tiagoantunes
    Thank you for confirmation
    Closing as duplicate of #57795

  3. github-actions commented on Aug 20, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  4. locked as resolved and limited conversation to collaborators on Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions