flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

Can run app with flutter_secure_storage

Open yalesnikov opened this issue 1 year ago • 3 comments
trafficstars

Hello. I try make an flutter app, but I have an error after installing package flutter_secure_storage. Without this package my app build successfully, but after adding this package I have an error:

Launching lib/main.dart on Android SDK built for arm64 in debug mode...
Running Gradle task 'assembleDebug'...
ERROR:/Users/user/- projects/- working/soho/sohoapp/build/path_provider_android/intermediates/runtime_library_classes_jar/debug/classes.jar: D8: java.lang.NullPointerException
ERROR:/Users/user/- projects/- working/soho/sohoapp/build/flutter_secure_storage/intermediates/runtime_library_classes_jar/debug/classes.jar: D8: java.lang.NullPointerException

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform classes.jar (project :path_provider_android) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.3.0, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.gradle.internal.attributes.VariantAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/user/- projects/- working/soho/sohoapp/build/path_provider_android/intermediates/runtime_library_classes_jar/debug/classes.jar.
         > Error while dexing.
   > Failed to transform classes.jar (project :flutter_secure_storage) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, com.android.build.api.attributes.AgpVersionAttr=7.3.0, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.gradle.internal.attributes.VariantAttr=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/user/- projects/- working/soho/sohoapp/build/flutter_secure_storage/intermediates/runtime_library_classes_jar/debug/classes.jar.
         > Error while dexing.

* 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 1s
name: sohoapp
description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: '>=3.2.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  provider: ^6.1.1
  http: ^1.1.2
  carousel_slider: ^4.2.1
  flutter_secure_storage: ^9.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter


  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true

yalesnikov avatar Feb 01 '24 05:02 yalesnikov

For what it's worth: I've run into similar issues, and usually it had something to do with incompatible gradle or Kotling versions or something like that. You might want to open the Android part of your app in Android Studio and attempt an update of gradle. And don't forget to clear all build data. Sorry that I can't be more specific. That's what I did, and it worked somehow...

komaxx avatar Mar 20 '24 17:03 komaxx

I'm having a similar issue. Just now (a day later) narrowed it down to flutter_secure_storage, and am now researching a workaround.

Steps to recreate:

  1. I created a new app, and it built successfully.
  2. I then added flutter_secure_storage: ^9.2.1, and it failed to build with the error below pertaining to path_provider_android. 9.0.0 didn't work either.
  3. I removed the dependency, and it built successfully again.

I've tried on channels master and beta. Will try to download Flutter version next.

$ flutter run
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':path_provider_android'.
> Could not load compiled classes for build file 'C:\Users\micro\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_android-2.2.4\android\build.gradle' from cache.
> Failed to notify project evaluation listener.
   > Could not get unknown property 'android' for project ':path_provider_android' of type org.gradle.api.Project.
   > Could not get unknown property 'android' for project ':path_provider_android' of type org.gradle.api.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 12s
Running Gradle task 'assembleDebug'...                             13.0s
Error: Gradle task assembleDebug failed with exit code 1
`flutter doctor -v`

$ flutter doctor -v [√] Flutter (Channel master, 3.22.0-36.0.pre.47, on Microsoft Windows [Version 10.0.22631.3593], locale en-US) • Flutter version 3.22.0-36.0.pre.47 on channel master at C:\dev\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ac6409b311 (5 hours ago), 2024-05-17 18:30:13 -0700 • Engine revision 93f1b5a146 • Dart version 3.5.0 (build 3.5.0-167.0.dev) • DevTools version 2.36.0-dev.10

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\apps\Android\Sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\apps\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps X Visual Studio not installed; this is necessary to develop Windows apps. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2023.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 17.0.10+0--11572160)

[√] Connected device (4 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3593] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.209 • Edge (web) • edge • web-javascript • Microsoft Edge 124.0.2478.105

[√] Network resources • All expected network resources are available.

! Doctor found issues in 1 category.

KDCinfo avatar May 18 '24 06:05 KDCinfo

I found downgrading flutter_secure_storage to 8.1.0 got it working, even after upgrading to the latest version of Flutter (beta channel).

dependencies:
  flutter_secure_storage: ^8.1.0

KDCinfo avatar May 18 '24 09:05 KDCinfo

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Aug 13 '24 20:08 github-actions[bot]

I am closing all older issues. If this issue still exists in the latest version, please let me know.

juliansteenbakker avatar Aug 13 '24 20:08 juliansteenbakker