App hanging when it hits "shared_preferences" plugin.

333 views
Skip to first unread message

Brent

unread,
Oct 6, 2020, 5:25:01 PM10/6/20
to Flutter Development (flutter-dev)
Hello.

I'm building my first app, so I'm probably doing something very stupid. My app works perfectly in my emulator, but as soon as I upload it to the Google Play store as an internal release, and download it to my phone to test, I'm having issues.

My first issue is the "shared_preferences" plugin, when I call:

SharedPreferences prefs = await SharedPreferences.getInstance();

I've commented out everything else and it works fine, but as soon as it hits this, the application just hangs forever.

Any help would greatly be appreciated!

My phone is a Moto G5 Plus running Android 8.

Here is flutter doctor:

[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale en-US)
    • Flutter version 1.20.4 at C:\src\flutter
    • Framework revision fba99f6cf9 (3 weeks ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2


[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\brent\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

Souvik Dutta Chowdhury

unread,
Oct 7, 2020, 5:16:14 AM10/7/20
to Brent, Flutter Development (flutter-dev)
I think you might try using firebase crashlytics or something similar to understand what is causing the crash.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/bcb8f0b6-a744-4176-a5a2-feabc0f52d21n%40googlegroups.com.

AW Results

unread,
Oct 7, 2020, 7:40:38 PM10/7/20
to Flutter Development (flutter-dev)

SharedPreferences _sharedPref;

testingSharedPreferences() async {

  _sharedPref = await SharedPreferences.getInstance();

    await _sharedPref.setString("savedPrefKey", "Saved this example string");

Reply all
Reply to author
Forward
0 new messages