Repository: flutter
Issue: [plugin] Shared preferences plugin caches values that fail to be stored on Android
Labels: platform-android,p: shared_preferences,package,P3,team-android,triaged-android

When storing of values in the Shared Preferences plugin fails for whatever reason on the Android side (e.g. by using a value that starts with one of the special prefixes at https://github.com/flutter/plugins/blob/master/packages/shared_preferences/shared_preferences/android/src/main/java/io/flutter/plugins/sharedpreferences/MethodCallHandlerImpl.java#L40-L42) a platform exception is thrown on the dart-side. If an app handles that exception on the dart-side, the value is not removed from the dart-side preference cache, which is an inconsistent state between dart and Android-sides.

## Steps to Reproduce

Run my bug demo at https://github.com/Cobinja/flutter_shared_preferences_bug_demo on Android
and click the button "Set value with exception handling".
As a comparison I also included a button that shows what happens without handling the exception.

**Expected results:** subsequent reads of the not-stored value should not return the value

**Actual results:** subsequent reads of the not-stored value do return the value

<details>
  <summary>Logs</summary>

```
[  +39 ms] executing: uname -m
[  +19 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +3 ms] executing: [/home/lmueller/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +3 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] executing: [/home/lmueller/flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[   +7 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] 2.2.3
[   +3 ms] executing: [/home/lmueller/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/lmueller/flutter/] git ls-remote --get-url origin
[   +3 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +48 ms] executing: [/home/lmueller/flutter/] git rev-parse --abbrev-ref HEAD
[   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +33 ms] 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.
[   +1 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.
[  +32 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb devices -l
[  +21 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86_arm model:sdk_gphone_x86_arm device:generic_x86_arm transport_id:1
[   +4 ms] /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[  +19 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 '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.
[  +41 ms] Skipping pub get: version match.
[  +13 ms] Found plugin path_provider_linux at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.2/
[   +4 ms] Found plugin path_provider_windows at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.3/
[   +3 ms] Found plugin shared_preferences at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.6/
[   +1 ms] Found plugin shared_preferences_linux at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.0.2/
[   +1 ms] Found plugin shared_preferences_macos at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.2/
[   +1 ms] Found plugin shared_preferences_web at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.1/
[   +1 ms] Found plugin shared_preferences_windows at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.0.2/
[  +57 ms] Found plugin path_provider_linux at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.2/
[   +1 ms] Found plugin path_provider_windows at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.3/
[   +1 ms] Found plugin shared_preferences at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.6/
[        ] Found plugin shared_preferences_linux at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.0.2/
[        ] Found plugin shared_preferences_macos at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.2/
[   +1 ms] Found plugin shared_preferences_web at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.1/
[        ] Found plugin shared_preferences_windows at /home/lmueller/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.0.2/
[   +8 ms] Generating /home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +22 ms] ro.hardware = ranchu
[   +9 ms] Using hardware rendering with device sdk gphone x86 arm. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
[  +16 ms] Initializing file store
[   +5 ms] Skipping target: gen_localizations
[   +2 ms] complete
[   +2 ms] Launching lib/main.dart on sdk gphone x86 arm in debug mode...
[   +2 ms] /home/lmueller/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/lmueller/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot
--sdk-root /home/lmueller/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.RLYMYA/flutter_tool.HMWCPM/app.dill --packages
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/3c113a45063dc6628e68a4111abcacad.cache.dill.track.dill
--enable-experiment=alternative-invalidation-strategy
[   +5 ms] executing: /home/lmueller/Android/Sdk/build-tools/30.0.3/aapt dump xmltree
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[   +3 ms] Exit code 0 from: /home/lmueller/Android/Sdk/build-tools/30.0.3/aapt dump xmltree
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
               A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
               A: package="com.example.shared_preferences_bug_demo" (Raw: "com.example.shared_preferences_bug_demo")
               A: platformBuildVersionCode=(type 0x10)0x1e
               A: platformBuildVersionName=(type 0x10)0xb
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="shared_preferences_bug_demo" (Raw: "shared_preferences_bug_demo")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=21)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.shared_preferences_bug_demo.MainActivity" (Raw: "com.example.shared_preferences_bug_demo.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=35)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: meta-data (line=45)
                     A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
                     A: android:resource(0x01010025)=@0x7f040000
                   E: intent-filter (line=49)
                     E: action (line=50)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=52)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=59)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +4 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[   +4 ms] <- compile package:shared_preferences_bug_demo/main.dart
[  +17 ms] --------- beginning of main
           08-15 19:39:00.002 D/KeyguardClockSwitch(  677): Updating clock: 739
[   +8 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb version
[   +3 ms] Android Debug Bridge version 1.0.41
           Version 31.0.2-7242960
           Installed as /home/lmueller/Android/Sdk/platform-tools/adb
[   +1 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb start-server
[  +11 ms] Building APK
[  +13 ms] Running Gradle task 'assembleDebug'...
[   +2 ms] Using gradle from /home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/android/gradlew.
[   +7 ms] executing: /home/lmueller/Android/android-studio/jre/bin/java -version
[  +63 ms] Exit code 0 from: /home/lmueller/Android/android-studio/jre/bin/java -version
[        ] openjdk version "11.0.10" 2021-01-19
           OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
           OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[        ] executing: [/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/android/]
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/android/gradlew -Pverbose=true -Ptarget-platform=android-x86
-Ptarget=/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/lib/main.dart -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==
-Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +377 ms] Welcome to Gradle 6.7!
[        ] Here are the highlights of this release:
[        ]  - File system watching is ready for production use
[        ]  - Declare the version of Java your build requires
[        ]  - Java 15 support
[        ] For more details see https://docs.gradle.org/6.7/release-notes.html
[+2191 ms] > Task :app:compileFlutterBuildDebug
[        ] [  +39 ms] executing: uname -m
[        ] [  +19 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +3 ms] executing: [/home/lmueller/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +2 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] [        ] executing: [/home/lmueller/flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] [   +6 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[        ] [        ] 2.2.3
[        ] [   +3 ms] executing: [/home/lmueller/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +1 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/lmueller/flutter/] git ls-remote --get-url origin
[        ] [   +1 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +33 ms] executing: [/home/lmueller/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +1 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +30 ms] 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.
[        ] [   +1 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.
[        ] [  +49 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' 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.
[        ] [        ] 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.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +13 ms] Initializing file store
[        ] [   +7 ms] Skipping target: gen_localizations
[        ] [   +3 ms] kernel_snapshot: Starting due to {}
[        ] [   +6 ms] /home/lmueller/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/lmueller/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/lmueller/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true
-Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/.dart_tool/package_config.json --output-dill
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/.dart_tool/flutter_build/c637628f7345fefeb57f963f69f9e184/app.dill --depfile
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/.dart_tool/flutter_build/c637628f7345fefeb57f963f69f9e184/kernel_snapshot.d
package:shared_preferences_bug_demo/main.dart
[+4494 ms] [+6114 ms] kernel_snapshot: Complete
[ +300 ms] [ +263 ms] debug_android_application: Starting due to {}
[ +100 ms] [  +90 ms] debug_android_application: Complete
[ +300 ms] [ +308 ms] Persisting file store
[        ] [   +4 ms] Done persisting file store
[        ] [   +3 ms] build succeeded.
[        ] [   +5 ms] "flutter assemble" took 6.882ms.
[        ] [   +2 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[  +99 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[        ] > Task :app:preBuild UP-TO-DATE
[        ] > Task :app:preDebugBuild UP-TO-DATE
[        ] > Task :shared_preferences:preBuild UP-TO-DATE
[        ] > Task :shared_preferences:preDebugBuild UP-TO-DATE
[        ] > Task :shared_preferences:compileDebugAidl NO-SOURCE
[        ] > Task :app:compileDebugAidl NO-SOURCE
[        ] > Task :shared_preferences:packageDebugRenderscript NO-SOURCE
[        ] > Task :app:compileDebugRenderscript NO-SOURCE
[        ] > Task :app:generateDebugBuildConfig UP-TO-DATE
[        ] > Task :shared_preferences:writeDebugAarMetadata UP-TO-DATE
[        ] > Task :app:checkDebugAarMetadata UP-TO-DATE
[        ] > Task :app:cleanMergeDebugAssets
[        ] > Task :app:mergeDebugShaders UP-TO-DATE
[        ] > Task :app:compileDebugShaders NO-SOURCE
[        ] > Task :app:generateDebugAssets UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugShaders UP-TO-DATE
[        ] > Task :shared_preferences:compileDebugShaders NO-SOURCE
[        ] > Task :shared_preferences:generateDebugAssets UP-TO-DATE
[        ] > Task :shared_preferences:packageDebugAssets UP-TO-DATE
[        ] > Task :app:mergeDebugAssets
[  +98 ms] > Task :app:copyFlutterAssetsDebug
[        ] > Task :app:generateDebugResValues UP-TO-DATE
[        ] > Task :app:generateDebugResources UP-TO-DATE
[        ] > Task :shared_preferences:compileDebugRenderscript NO-SOURCE
[        ] > Task :shared_preferences:generateDebugResValues UP-TO-DATE
[        ] > Task :shared_preferences:generateDebugResources UP-TO-DATE
[        ] > Task :shared_preferences:packageDebugResources UP-TO-DATE
[        ] > Task :app:mergeDebugResources UP-TO-DATE
[        ] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[        ] > Task :app:extractDeepLinksDebug UP-TO-DATE
[        ] > Task :shared_preferences:extractDeepLinksDebug UP-TO-DATE
[        ] > Task :shared_preferences:processDebugManifest UP-TO-DATE
[        ] > Task :app:processDebugMainManifest UP-TO-DATE
[        ] > Task :app:processDebugManifest UP-TO-DATE
[        ] > Task :app:processDebugManifestForPackage UP-TO-DATE
[        ] > Task :shared_preferences:compileDebugLibraryResources UP-TO-DATE
[        ] > Task :shared_preferences:parseDebugLocalResources UP-TO-DATE
[        ] > Task :shared_preferences:generateDebugRFile UP-TO-DATE
[        ] > Task :app:processDebugResources UP-TO-DATE
[        ] > Task :shared_preferences:generateDebugBuildConfig UP-TO-DATE
[        ] > Task :shared_preferences:javaPreCompileDebug UP-TO-DATE
[  +97 ms] > Task :shared_preferences:compileDebugJavaWithJavac UP-TO-DATE
[        ] > Task :shared_preferences:bundleLibCompileToJarDebug UP-TO-DATE
[        ] > Task :app:compileDebugKotlin UP-TO-DATE
[        ] > Task :app:javaPreCompileDebug UP-TO-DATE
[        ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[        ] > Task :app:compileDebugSources UP-TO-DATE
[        ] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[        ] > Task :app:processDebugJavaRes NO-SOURCE
[        ] > Task :shared_preferences:processDebugJavaRes NO-SOURCE
[        ] > Task :shared_preferences:bundleLibResDebug NO-SOURCE
[        ] > Task :app:mergeDebugJavaResource UP-TO-DATE
[        ] > Task :shared_preferences:bundleLibRuntimeToJarDebug UP-TO-DATE
[        ] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[        ] > Task :app:dexBuilderDebug UP-TO-DATE
[        ] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[        ] > Task :app:mergeExtDexDebug UP-TO-DATE
[        ] > Task :app:mergeDexDebug UP-TO-DATE
[        ] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugJniLibFolders UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugNativeLibs NO-SOURCE
[        ] > Task :shared_preferences:stripDebugDebugSymbols NO-SOURCE
[        ] > Task :shared_preferences:copyDebugJniLibsProjectOnly UP-TO-DATE
[        ] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[        ] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[        ] > Task :app:validateSigningDebug UP-TO-DATE
[        ] > Task :shared_preferences:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE
[        ] > Task :shared_preferences:extractDebugAnnotations UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugGeneratedProguardFiles UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugConsumerProguardFiles UP-TO-DATE
[        ] > Task :shared_preferences:prepareLintJarForPublish UP-TO-DATE
[        ] > Task :shared_preferences:mergeDebugJavaResource UP-TO-DATE
[        ] > Task :shared_preferences:syncDebugLibJars UP-TO-DATE
[        ] > Task :shared_preferences:bundleDebugAar UP-TO-DATE
[        ] > Task :shared_preferences:compileDebugSources UP-TO-DATE
[        ] > Task :shared_preferences:assembleDebug UP-TO-DATE
[ +397 ms] > Task :app:compressDebugAssets
[ +288 ms] > Task :app:packageDebug
[        ] > Task :app:assembleDebug
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[        ] BUILD SUCCESSFUL in 8s
[        ] 57 actionable tasks: 7 executed, 50 up-to-date
[ +325 ms] Running Gradle task 'assembleDebug'... (completed in 9,2s)
[  +38 ms] calculateSha: LocalDirectory: '/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk'/app.apk
[ +386 ms] ✓  Built build/app/outputs/flutter-apk/app-debug.apk.
[   +1 ms] executing: /home/lmueller/Android/Sdk/build-tools/30.0.3/aapt dump xmltree
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[   +5 ms] Exit code 0 from: /home/lmueller/Android/Sdk/build-tools/30.0.3/aapt dump xmltree
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
               A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
               A: package="com.example.shared_preferences_bug_demo" (Raw: "com.example.shared_preferences_bug_demo")
               A: platformBuildVersionCode=(type 0x10)0x1e
               A: platformBuildVersionName=(type 0x10)0xb
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="shared_preferences_bug_demo" (Raw: "shared_preferences_bug_demo")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=21)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.shared_preferences_bug_demo.MainActivity" (Raw: "com.example.shared_preferences_bug_demo.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: meta-data (line=35)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: meta-data (line=45)
                     A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
                     A: android:resource(0x01010025)=@0x7f040000
                   E: intent-filter (line=49)
                     E: action (line=50)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=52)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=59)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[        ] Stopping app 'app.apk' on sdk gphone x86 arm.
[        ] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.example.shared_preferences_bug_demo
[  +23 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell pm list packages com.example.shared_preferences_bug_demo
[  +19 ms] package:com.example.shared_preferences_bug_demo
[   +1 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell cat /data/local/tmp/sky.com.example.shared_preferences_bug_demo.sha1
[  +10 ms] 8c51908081103eee1c26173bf067077843af04ac
[        ] Installing APK.
[        ] Installing build/app/outputs/flutter-apk/app.apk...
[        ] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 install -t -r
/home/lmueller/programmieren/flutter/playground/shared_preferences_bug_demo/build/app/outputs/flutter-apk/app.apk
[ +400 ms] Performing Streamed Install
                    Success
[        ] Installing build/app/outputs/flutter-apk/app.apk... (completed in 400ms)
[        ] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell echo -n 8061b2ea12dd017010151f2a34f0f7f15dccb0de >
/data/local/tmp/sky.com.example.shared_preferences_bug_demo.sha1
[  +10 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +39 ms] --------- beginning of kernel
           08-15 19:39:12.207 D/logd    (    0): logdr: UID=2000 GID=2000 PID=5763 n tail=1 logMask=99 pid=0 start=0ns timeout=0ns
[   +4 ms] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation
true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true
com.example.shared_preferences_bug_demo/com.example.shared_preferences_bug_demo.MainActivity
[  +37 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.shared_preferences_bug_demo/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...
[ +590 ms] Observatory URL on device: http://127.0.0.1:41387/M1Og6cW3l4Y=/
[        ] executing: /home/lmueller/Android/Sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:41387
[   +4 ms] 33179
[        ] Forwarded host port 33179 to device port 41387 for Observatory
[   +4 ms] Caching compiled dill
[  +34 ms] Connecting to service protocol: http://127.0.0.1:33179/M1Og6cW3l4Y=/
[ +137 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:33179/M1Og6cW3l4Y=/.
[ +111 ms] DDS is listening at http://127.0.0.1:39061/PZsDRWvwieU=/.
[  +36 ms] Successfully connected to service protocol: http://127.0.0.1:33179/M1Og6cW3l4Y=/
[  +12 ms] DevFS: Creating new filesystem on the device (null)
[  +28 ms] DevFS: Created new filesystem on the device
(file:///data/user/0/com.example.shared_preferences_bug_demo/code_cache/shared_preferences_bug_demoAWWJIJ/shared_preferences_bug_demo/)
[   +2 ms] Updating assets
[  +51 ms] Syncing files to device sdk gphone x86 arm...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +1 ms] <- recompile package:shared_preferences_bug_demo/main.dart 79821581-7925-4c81-a4c9-812bd975650d
[        ] <- 79821581-7925-4c81-a4c9-812bd975650d
[  +84 ms] Updating files.
[        ] DevFS: Sync finished
[        ] Syncing files to device sdk gphone x86 arm... (completed in 87ms)
[        ] Synced 0.0MB.
[        ] <- accept
[   +4 ms] Connected to _flutterView/0xf168d820.
[   +1 ms] Flutter run key commands.
[        ] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] 💪 Running with sound null safety 💪
[        ] An Observatory debugger and profiler on sdk gphone x86 arm is available at: http://127.0.0.1:39061/PZsDRWvwieU=/
[  +39 ms] Activating Dart DevTools...
[+3341 ms] Activating Dart DevTools... (completed in 3,3s)
[ +320 ms] The Flutter DevTools debugger and profiler on sdk gphone x86 arm is available at: http://127.0.0.1:9103?uri=http%3A%2F%2F127.0.0.1%3A39061%2FPZsDRWvwieU%3D%2F
[+10537 ms] I/flutter ( 5808): Exception caught: PlatformException
```

```
Analyzing shared_preferences_bug_demo...                                
No issues found! (ran in 0.8s)
```

```
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on Linux, locale de_DE.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.59.0)
[✓] Connected device (1 available)

• No issues found!
```

</details>