1

I released an app for android. I wanted to make some updates and after update, it started to freeze in starting as white screen. When I debug, it works perfectly in the same device which freezes after downloading from store. In emulator, I download the app from store and it works. What can be the problem causing that?

I use command flutter build appbundle --obfuscate --split-debug-info=somepath

build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.3.5'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

pubspec.yaml:

environment:
  sdk: ">=2.10.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.1
  url_launcher: ^6.0.2
  flutter_secure_storage: ^3.3.5
  shared_preferences: ^2.0.5
  provider: ^5.0.0
  toast: ^0.1.5
  onesignal_flutter: ^2.6.2
  fl_chart: ^0.20.1
  intl: ^0.17.0
  device_info: ^2.0.0
  synchronized: ^3.0.0
  firebase_core: ^1.0.3
  firebase_performance: ^0.6.0+2
  flutter_localizations:
    sdk: flutter
  workmanager: ^0.4.0
  get_it: ^7.1.3
  image_picker: ^0.8.0+3


  

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  google_fonts: ^2.0.0



dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  generate: true
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/
  #  - images/a_dot_ham.jpeg
  fonts:
    - family: Roboto
      fonts:
        - asset: fonts/Roboto-Medium.ttf
        - asset: fonts/Roboto-Regular.ttf
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

I tried to make my gradle version 3.5.1 I also tried to delete the packages I added but it still freezes when downloading from store.

Edit: I see that error in logcat when app is starting:

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(Exception encountered, read, javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
        at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
        at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:602)
        at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:365)
        at javax.crypto.Cipher.doFinal(Cipher.java:2055)
        at c.b.a.b.b.b(Unknown Source:32)
        at c.b.a.a.b(Unknown Source:11)
        at c.b.a.a.d(Unknown Source:7)
        at c.b.a.a.a(Unknown Source:0)
        at c.b.a.a$b.run(Unknown Source:134)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.os.HandlerThread.run(HandlerThread.java:67)
    , null)

Edit 2: As I look-up, this may cause because of flutter_secure_storage package. I am doing a .read in my main and many people faced this issue as I see. What I do now is, I will try to change flutter_secure_storage version as long as I find the working version.

aoiTenshi
  • 547
  • 1
  • 6
  • 20
  • are you sure you're not not initializing any of the flutter_secure_storage's keys as empty strings? – Gui Silva Aug 16 '21 at 15:17
  • @GuilhermeV. I am pretty sure but I will double-check that. Also, if that is the case, same code, same build giving error with some devices and works perfectly with some others. Wouldn't be the case error for every device? – aoiTenshi Aug 16 '21 at 16:43

2 Answers2

1

You need to allow HTTP traffic\network access permissions in your AndroidManifest.xml.

Check this answer.

Huthaifa Muayyad
  • 11,321
  • 3
  • 17
  • 49
0

The most common cause of this error is the device's android API version.

steps to solve this issue:

  • Upgrade both targetSdkVersion and compileSdkVersion to the latest version(be the answer posted 30 is the last version).

  • Run the app in release mode using the devices that show the error by terminal

flutter run --release

.

  • May use firebase Crashlytics! to track issues/errors like this.
Muhamad Jalal
  • 312
  • 2
  • 14